Skip to content
Browse files

Add ability to limit plugin activation to specific users.

  • Loading branch information...
1 parent f230894 commit 82db25047876a4c3b840cc17eee132ae665aade8 @joshbetz joshbetz committed Jul 9, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 bulk-user-management.php
View
14 bulk-user-management.php
@@ -72,7 +72,8 @@ public function enqueue_scripts() {
}
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' ) );
}
/**
@@ -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();

0 comments on commit 82db250

Please sign in to comment.
Something went wrong with that request. Please try again.