Site logo

Archived topic

Better management of metaboxes capabilities on Multisite

4 replies · Started by Francesco on April 16, 2016

Viewing posts 1–5 of 5

Hi Tom,

this is the first time I write here so first of all I wanna declare my LOVE for you theme and all the awesome add ons ;) Superb job!

I'd like to suggest something to make it play better on multisite.

When the theme generates metaboxes it requires the minimum permissions as it follows:

// Set user role - make filterable
$allowed = apply_filters( 'generate_metabox_capability', 'activate_plugins' );

But on WP Multisite usually only SuperAdmin can activate plugins - depending from network configuration.

So, to make sun sites Administrators play with sidebar and footer I need to filter that variable on my child theme.

// add capability to site admin for gp metaboxes
add_filter( 'generate_metabox_capability', 'multisite_admin_metabox_capability', 10, 1 );
function multisite_admin_metabox_capability( $allowed ) {
    $allowed = 'switch_themes';
    return $allowed;
}

I think it can be good to allow by default Administrators to edit that metaboxes on multisite.

Best,
Francesco

Hi there,

Thanks for the suggestion! This is why I made it filterable, so people can switch it around.

So you're suggesting I use the "switch_themes" capability over the "activate_plugins"?

What about "edit_theme_options"?

Hi Tom,

thank you for quick turnaround.

Yes, exactly that's my suggestion!

'edit_theme_options' would be perfect as well ;)

Cheers,
Francesco

Done :)

Thanks for the suggestion!

Thank you Tom! ;)

This archived topic is closed to new replies.