From c5694eaf59bcbde165fa2df918e6c1007d5429ff Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Fri, 10 Jun 2022 10:17:43 -0700 Subject: [PATCH] Add 'View Requests Log' link on plugins.php --- log-http-requests.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/log-http-requests.php b/log-http-requests.php index 23ab84f..005b4d0 100644 --- a/log-http-requests.php +++ b/log-http-requests.php @@ -42,6 +42,7 @@ function __construct() { add_action( 'init', [ $this, 'init' ] ); add_action( 'admin_menu', [ $this, 'admin_menu' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'admin_scripts' ] ); + add_filter( 'plugin_action_links_' . LHR_BASENAME, [ $this, 'plugins_page_link' ] ); add_filter( 'http_request_args', [ $this, 'start_timer' ] ); add_action( 'http_api_debug', [ $this, 'capture_request' ], 10, 5 ); add_action( 'lhr_cleanup_cron', [ $this, 'cleanup' ] ); @@ -100,6 +101,12 @@ function admin_scripts( $hook ) { } + function plugins_page_link( $action_links ) { + $settings_page_url = admin_url( "tools.php?page=log-http-requests" ); + array_unshift( $action_links, '' . __( 'View Requests Log', 'log-http-requests' ) . '' ); + return $action_links; + } + function lhr_query() { check_ajax_referer( 'lhr_nonce' );