• Resolved frnkoc

    (@frnkoc)


    Hi.
    I tried to install smart coupons plugin but it seems that plugin organizer is blocking the submenu creation.
    If i activate the smart coupons plugin first the submenus for settings, welcome page and coupons work perfectly. As soon as i activate Plugin Organizer the tabs dissapear.
    If i activate first Plugin Organizer then Smart Coupons the welcome page after activation generates a 403 error.
    This is the results:

    $ grep -irn "Sorry, you are not allowed to access this page." --include="*.php" ../wordpress-4.9.7/ 
    ../wordpress-4.9.7/wp-admin/includes/menu.php:342:    wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );

    Then were we see it occur in wp-admin/includes/menu.php file:

    $ tail -n 15 ../wordpress-4.9.7/wp-admin/includes/menu.php
    unset( $last_menu_key );
    if ( !user_can_access_admin_page() ) {
        /**
         * Fires when access to an admin page is denied.
         *
         * @since 2.5.0
         */
        do_action( 'admin_page_access_denied' );
        wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
    }
    $menu = add_menu_classes($menu);

    So can you check how user_can_access_admin_page() function (or admin_page_access_denied action hook being called) is being modifyed by Plugin Organizer, to see if it needs tweaks to allow the Smart Coupons to pass that condition.

    This is the actual function:

    if ( ! class_exists( 'SC_Admin_Welcome' ) ) {
    
        /**
         * SC_Admin_Welcome class
         */
        class SC_Admin_Welcome {
    
            /**
             * Variable to hold instance of SC_Admin_Welcome
             * @var $instance
             */
            private static $instance = null;
    
            /**
             * Hook in tabs.
             */
            public function __construct() {
                add_action( 'admin_menu', array( $this, 'admin_menus' ) );
                add_action( 'admin_head', array( $this, 'admin_head' ) );
                add_action( 'admin_init', array( $this, 'sc_welcome' ) );
            }
    
            /**
             * Get single instance of SC_Admin_Welcome
             *
             * @return SC_Admin_Welcome Singleton object of SC_Admin_Welcome
             */
            public static function get_instance() {
                // Check if instance is already exists
                if ( is_null( self::$instance ) ) {
                    self::$instance = new self();
                }
    
                return self::$instance;
            }
    
            /**
             * Add admin menus/screens.
             */
            public function admin_menus() {
    
                if ( empty( $_GET['page'] ) ) {
                    return;
                }
    
                $welcome_page_name  = __( 'About Smart Coupons', WC_SC_TEXT_DOMAIN );
                $welcome_page_title = __( 'Welcome to Smart Coupons', WC_SC_TEXT_DOMAIN );
    
                switch ( $_GET['page'] ) {
                    case 'sc-about' :
                        add_submenu_page( 'woocommerce', $welcome_page_title, $welcome_page_name, 'manage_options', 'sc-about', array( $this, 'about_screen' ) );
                        break;
                    case 'sc-faqs' :
                         add_submenu_page( 'woocommerce', $welcome_page_title, $welcome_page_name, 'manage_options', 'sc-faqs', array( $this, 'faqs_screen' ) );
                        break;
                }
            }

    so it would appear that before it is able to get to the add_submenu_page(), the add_action( 'admin_menu', array( $this, 'admin_menus' ) ); action is happening for admin_menu Which doesn’t allow it to get to the add_submenu_page() point.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 19 total)
Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Smart Coupons Conflict.’ is closed to new replies.