Skip to content

Commit

Permalink
Add ability to limit plugin activation to specific users.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbetz committed Jul 9, 2012
1 parent f230894 commit 82db250
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bulk-user-management.php
Expand Up @@ -72,7 +72,8 @@ public function enqueue_scripts() {
} }


public function register_menus() { public function register_menus() {
add_submenu_page( $this->parent_page, esc_html__( 'Bulk User Management', 'bulk-user-management' ), esc_html__( 'User Management', 'bulk-user-management' ), 'manage_options', self::PAGE_SLUG, array( $this, 'users_page' ) ); if ( $this->current_user_can_bulk_edit() )
add_submenu_page( $this->parent_page, esc_html__( 'Bulk User Management', 'bulk-user-management' ), esc_html__( 'User Management', 'bulk-user-management' ), 'manage_options', self::PAGE_SLUG, array( $this, 'users_page' ) );
} }


/** /**
Expand Down Expand Up @@ -336,6 +337,17 @@ public function remove_users($blogids = array(), $userids = array()) {
} }
} }
} }

public static function current_user_can_bulk_edit() {
if ( is_super_admin() )
return true;

$admins = array_map( 'intval', apply_filters( 'bulk_user_management_admin_users', array() ) );
if ( in_array( get_current_user_id(), $admins ) )
return true;

return false;
}
} }


$Bulk_User_Management = new Bulk_User_Management(); $Bulk_User_Management = new Bulk_User_Management();

0 comments on commit 82db250

Please sign in to comment.