WordPress.org

Ready to get started?Download WordPress

Forums

User Switching
[resolved] Notices (4 posts)

  1. Pietro Gregorini
    Member
    Posted 1 year ago #

    When I switch to a user, I get several notices with Debug active all over the page (at the top and in the menu on the left):

    Notice: Undefined offset: 2 in /web/htdocs/home/wp-admin/includes/plugin.php on line 1419 Notice: Undefined offset: 2 in /web/htdocs/home/wp-admin/includes/plugin.php on line 1419
    Skip to main content Notice: Undefined offset: 2 in /web/htdocs/home/wp-admin/includes/plugin.php on line 1419 Notice: Undefined offset: 2 in /web/htdocs/home/wp-admin/includes/plugin.php on line 1419

    http://wordpress.org/extend/plugins/user-switching/

  2. John Blackbourn
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Pietro,

    Those notices don't appear for me on any of the many sites that I use User Switching on.

    Can you disable all other plugins and switch to the default theme and see if the issue persists?

    John

  3. Pietro Gregorini
    Member
    Posted 1 year ago #

    Ok, I just tried right now disabling all other plugins except User Switching and I got the same notices.

    Then I got a suspect, even if the notice was related to "plugin.php" file and not to my theme files: I tried disabling the dashboard hacks in my functions.php and I didn't got any more notices.

    The code which gave me problems was this, used to change menu labels:

    // Change "Posts" menu with new labels
    function change_post_menu_label() {
    	global $menu;
    	global $submenu;
    	$menu[5][0] = 'Articles';
    	$submenu['edit.php'][5][0] = 'All Articles';
    	$submenu['edit.php'][10][0] = 'Add New';
    	$submenu['edit.php'][15][0] = 'Topics'; // Change name for Categories
    	$submenu['edit.php'][16][0] = 'Tags'; // Change name for Tags
    	echo '';
    }
    add_action('admin_menu', 'change_post_menu_label');

    Could you give me some instruction to solve this issue?

  4. Pietro Gregorini
    Member
    Posted 1 year ago #

    Ok, I resolved deleting the parts not supported by non-administrators users, so the code became simply:

    // Change "Posts" menu with new labels
    function change_post_menu_label() {
    	global $menu;
    	global $submenu;
    	$menu[5][0] = 'Articles';
    	$submenu['edit.php'][5][0] = 'All Articles';
    	$submenu['edit.php'][10][0] = 'Add New';
    	echo '';
    }
    add_action('admin_menu', 'change_post_menu_label');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags