WordPress.org

Make WordPress Core

#21123 closed enhancement (fixed)

Enforce multisite plugins menu preference in map_meta_cap()

Reported by: nacin Owned by: nacin
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Multisite Keywords:
Focuses: Cc:

Description

Rather than doing this:

if ( is_multisite() ) {
	$menu_perms = get_site_option( 'menu_items', array() );

	if ( empty( $menu_perms['plugins'] ) && ! current_user_can( 'manage_network_plugins' ) )
		wp_die( __( 'Cheatin’ uh?' ) );
}

if ( !current_user_can('activate_plugins') )
	wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );

We should simply map activate_plugins to manage_network_plugins in map_meta_cap() when the conditionals are proper.

Change History (3)

comment:1 nacin22 months ago

  • Owner set to nacin
  • Status changed from new to accepted

comment:2 nacin22 months ago

Additionally, these checks make little sense in the network admin:

$menu_perms = get_site_option( 'menu_items', array() );

if ( empty( $menu_perms['themes'] ) && ! is_super_admin() )
	wp_die( __( 'Cheatin’ uh?' ) );

if ( !current_user_can('manage_network_themes') )
	wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) );

comment:3 nacin22 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In [21198]:

Enforce multisite plugins menu preference in map_meta_cap(). This means a simple current_user_can('activate_plugins') check will handle the 'Enable administration menus' setting.

Remove bogus checks for enabling/disabling the 'themes' menu (something core does not handle out of the box) when in the network admin.

fixes #21123.

Note: See TracTickets for help on using tickets.