Tagged: notice
- This topic has 7 replies, 2 voices, and was last updated 9 years, 2 months ago by Syam Mohan.
-
AuthorPosts
-
October 20, 2015 at 7:26 pm #17804Phila DelphiaSpectator
Hello,
I’m getting an error on certain roles that I create. It seems to happen when I remove the “Edit Pages” capability. This is both happening on the built-in Subscriber role as well as some custom roles I have created. Essentially, my goal is to have roles that only have access to CPTs and not Pages or Posts. I know I can hide those items in the admin menu, but I would prefer those users to not be able to navigate to pages at all in the admin.
Here is the error:
Undefined offset: 2 in
/wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.phpAny insights?
October 20, 2015 at 7:43 pm #17806Syam MohanKeymasterHi Karissa,
Usually there will be a line number along with that error message. Do you have a line number in your log?
Thanks
Syam
October 20, 2015 at 11:14 pm #17823Phila DelphiaSpectatorSorry, yes:
Notice: Undefined offset: 2 in /wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.php on line 33And before the above notice, there is one from wordpress:
Notice: Undefined offset: 2 in /wp/wp-admin/includes/plugin.php on line 1566So I’m wondering if there is something as simple as a missing param?
October 21, 2015 at 1:54 pm #17859Syam MohanKeymasterHi Karissa,
That line number doesn’t make sense. Line #33 is a private variable declaration. There shouldn’t be an undefined offset.
This is a PHP Notice, not an error. Nothing will fail because of this notice. It will display on your screen, if you have debug display enabled.
Do you have any PHP fatal error in your log?
Thanks
Syam
October 21, 2015 at 8:12 pm #17873Phila DelphiaSpectatorHi Syam,
Thanks for your quick response. I realize these are notices and yes, things do work even with the notices appearing. But I would prefer for them not to appear at all 🙂
There are no fatal errors.
I can consistently make the notices appear when I remove the “Edit Pages” capability from any of the standard WordPress roles, or apply a role like “Author,” which does not have Edit Pages capability by default.
Here is the full error log:
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.php on line 331
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.php on line 331
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.php on line 331
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp-content/plugins/wpfront-user-role-editor-personal-pro/classes/personal-pro/class-wpfront-user-role-editor-menu-editor.php on line 331
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp/wp-admin/menu-header.php on line 135
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp/wp-admin/menu-header.php on line 136
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp/wp-admin/menu-header.php on line 139
PHP message: PHP Notice: Undefined offset: 2 in /vagrant/wp/wp-admin/menu-header.php on line 143
PHP message: PHP Notice: Undefined offset: 1 in /vagrant/wp/wp-admin/menu-header.php on line 166
PHP message: PHP Notice: Undefined offset: 1 in /vagrant/wp/wp-admin/menu-header.php on line 166″October 22, 2015 at 10:29 am #17911Syam MohanKeymasterHi Karissa,
Within line #331, offset 2 is where it reads the menu slug. If that is undefined, then one of your menu doesn’t have a slug. Can you take a look into your menu editor screen and check whether all the menus have a slug?
Thanks
Syam
October 22, 2015 at 9:01 pm #17952Phila DelphiaSpectatorGot it. Thanks for pointing me in the right direction.
For anyone else: I was re-labeling “Pages” and the pages submenu to something else using the pretty standard method found here: http://code.tutsplus.com/articles/customizing-your-wordpress-admin–wp-24941
However, that method doesn’t allow you to specify a submenu slug, causing the notice found above.
I ended up having to use remove_submenu_page() to remove those submenus entirely and add_submenu_page() to add them back with the labels that I wanted. No more notices! This technique might a bit convoluted, but it does work.
October 22, 2015 at 9:27 pm #17953Syam MohanKeymasterGlad to help.
Thanks
Syam
-
AuthorPosts
- The topic ‘Errors when "edit pages" capability is removed’ is closed to new replies.