Making WordPress.org

Changeset 12523


Ignore:
Timestamp:
03/31/2023 04:37:30 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Redirect the old plugin tools URLs to the new url.

See #6864.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-author-cards.php

    r12507 r12523  
    2727        private function __construct() {
    2828                add_action( 'admin_menu', array( $this, 'add_to_menu' ) );
     29                add_action( 'admin_page_access_denied', array( $this, 'admin_page_access_denied' ) );
    2930        }
    3031
    … …  
    4344
    4445                add_action( "admin_print_styles-{$hook}", array( $this, 'enqueue_assets' ) );
     46        }
     47
     48        /**
     49         * Redirect the old location.
     50         */
     51        public function admin_page_access_denied() {
     52                global $pagenow, $plugin_page;
     53                if (
     54                        isset( $pagenow, $plugin_page ) &&
     55                        'tools.php' === $pagenow &&
     56                        'authorcards' === $plugin_page
     57                ) {
     58                        wp_safe_redirect( admin_url( "admin.php?page={$plugin_page}" ) );
     59                        exit;
     60                }
    4561        }
    4662
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php

    r12507 r12523  
    2525        private function __construct() {
    2626                add_action( 'admin_menu', array( $this, 'add_to_menu' ) );
     27                add_action( 'admin_page_access_denied', array( $this, 'admin_page_access_denied' ) );
    2728        }
    2829
    … …  
    3940                        array( $this, 'show_stats' )
    4041                );
     42        }
     43
     44        /**
     45         * Redirect the old location.
     46         */
     47        public function admin_page_access_denied() {
     48                global $pagenow, $plugin_page;
     49                if (
     50                        isset( $pagenow, $plugin_page ) &&
     51                        'tools.php' === $pagenow &&
     52                        'statsreport' === $plugin_page
     53                ) {
     54                        wp_safe_redirect( admin_url( "admin.php?page={$plugin_page}" ) );
     55                        exit;
     56                }
    4157        }
    4258
Note: See TracChangeset for help on using the changeset viewer.