WPFront
  • Home
  • Plugins
    • Notification Bar Plugin
      • Plugin Ideas
      • Plugin Settings
      • Plugin FAQ
    • Scroll Top Plugin
      • Plugin Settings
      • Plugin FAQ
    • User Role Editor Plugin
      • Plugin Documentation
      • Plugin Settings
      • Plugin FAQ
    • Paddle Gateway Plugin
  • Go Pro
  • Support
    • Documentation
    • FAQ
  • Affiliates
  • Contact
  • Login
  • Cart

Tagged: notice

  • This topic has 7 replies, 2 voices, and was last updated 9 years, 6 months ago by Syam Mohan.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • October 20, 2015 at 7:26 pm #17804
    Phila Delphia
    Spectator

    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.php

    Any insights?

    October 20, 2015 at 7:43 pm #17806
    Syam Mohan
    Keymaster

    Hi 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 #17823
    Phila Delphia
    Spectator

    Sorry, 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 33

    And before the above notice, there is one from wordpress:
    Notice: Undefined offset: 2 in /wp/wp-admin/includes/plugin.php on line 1566

    So I’m wondering if there is something as simple as a missing param?

    October 21, 2015 at 1:54 pm #17859
    Syam Mohan
    Keymaster

    Hi 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 #17873
    Phila Delphia
    Spectator

    Hi 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 #17911
    Syam Mohan
    Keymaster

    Hi 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 #17952
    Phila Delphia
    Spectator

    Got 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 #17953
    Syam Mohan
    Keymaster

    Glad to help.

    Thanks

    Syam

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Errors when "edit pages" capability is removed’ is closed to new replies.
Log In
Lost Password

Search Topics

Documentation

FAQ
Roles List Add Role Edit Role Delete Role Restore Role Add or Remove Capability Assign/Migrate Users Posts/Pages Extended Permissions Custom Post Type Permissions Navigation Menu Permissions Widget Permissions Admin Menu Editor Media/Attachment File Permissions User Level Permissions Content Restriction Shortcodes Login Redirect Export Roles Import Roles Bulk Edit Settings Multisite Roles List Multisite Add New Role Multisite Edit Role Multisite Delete Role Multisite Restore Role Multisite Sync Roles Multisite Settings WordPress Capabilities Actions and Filters Installation Instructions