diff --git a/README.md b/README.md index 167a3e8..6eb9b38 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ It's also possible to install the plugin via Composer: ## Changelog +### 1.0.3 + +- Exclude all super admins from the list of admins. + ### 1.0.2 - Add Norwegian translation. diff --git a/readme.txt b/readme.txt index 172edc1..28d5fc5 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: super admin, multisite, admin, switch Requires at least: 6.0 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 1.0.2 +Stable tag: 1.0.3 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -29,6 +29,9 @@ It lists all admins for the current site, except for the super admin., and creat == Changelog == += 1.0.3 = +* Exclude all super admins from the list of admins. + = 1.0.2 = * Add Norwegian translation. diff --git a/super-admin-switch-to-admin.php b/super-admin-switch-to-admin.php index 1e3d3cb..928ed3a 100644 --- a/super-admin-switch-to-admin.php +++ b/super-admin-switch-to-admin.php @@ -12,7 +12,7 @@ * Plugin URI: https://github.com/soderlind/super-admin-switch-to-admin * GitHub Plugin URI: https://github.com/soderlind/super-admin-switch-to-admin * Description: If you are logged in as a super admin, allows you to switch to a regular admin account on the current site. - * Version: 1.0.2 + * Version: 1.0.3 * Author: Per Soderlind * Author URI: https://soderlind.no * Network: true @@ -73,12 +73,12 @@ public function switch_to_admin() { return; } - // List all admins for the current site, except for the super admin. + // List all admins for the current site, except for the super admins. $admins = get_users( [ 'blog_id' => \get_current_blog_id(), 'role' => 'administrator', - 'exclude' => [ get_current_user_id() ], + 'exclude' => $this->get_super_admins_ids(), ] ); @@ -94,7 +94,6 @@ public function switch_to_admin() { } } - /** * Admin notice. * @@ -125,6 +124,21 @@ public function admin_notice() { ID; + } + return $super_admins_ids; + } + } new SuperAdminSwitchToAdmin();