[Resolved] Page options working only for network administrator

Home Forums Support [Resolved] Page options working only for network administrator

Home Forums Support Page options working only for network administrator

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #117460
    Roberto Enrique

    Today I realized that sidebar and footer widgets options are visible only for Network Admin and not for Single Administrator.

    This is single site admin

    This is Network Admin

    This is really weird

    #117465
    Tom
    Lead Developer
    Lead Developer

    Single site admin vs network admin shouldn’t matter – those metaboxes only show for users who have the activate_plugins capability.

    You can alter this by adding your own filter:

    add_filter( 'generate_metabox_capability','generate_custom_metabox_capability' );
    function generate_custom_metabox_capability()
    {
          return 'activate_plugins';
    }

    Here’s a list of capabilities: https://codex.wordpress.org/Roles_and_Capabilities

    You’ll see “activate_plugins” as the first one under “Administrator”.

    Are you sure you have those two metaboxes selected under “Screen Options”?

    #117476
    Roberto Enrique

    Ok,my issue resides here:

    I’ll have to learn to be less paranoid and let my site admins to activate/deactivate plugins.

    Thanks Tom.

    #117477
    Tom
    Lead Developer
    Lead Developer

    You can always change it to whatever capability you like – that’s the beauty of filters πŸ™‚

    #125467
    Roberto Enrique

    Is it possible to add this filter as a mu-plugin?
    This way i don’t need to create a child theme just for this.

    Thanks in advance

    #125475
    Roberto Enrique

    Ok, I’ve just created the plug-in… it was ridiculously simple.

    Thanks

    #125512
    Tom
    Lead Developer
    Lead Developer

    Awesome πŸ™‚

    For others, this plugin makes creating plugins super simple: https://wordpress.org/plugins/pluginception/

    #166965
    Roberto Enrique

    This is not working anymore πŸ™
    Sections and Disable elements are working as expected but not for Footer Widgets or Sidebar Layout

    • This reply was modified 8 years, 3 months ago by Roberto Enrique.
    #166967
    Roberto Enrique

    Ok, fixed it. My fault.

    
    add_filter( 'generate_metabox_capability','generate_custom_metabox_capability' );
    
    function generate_custom_metabox_capability()
    {
          return 'delete_pages';
    }
    
    
    #167008
    Tom
    Lead Developer
    Lead Developer

    Glad you got this figured out! πŸ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.