Skip to content

Commit

Permalink
Fix view_admin_as_superior_admins filter was not working for single…
Browse files Browse the repository at this point in the history
… installations

See #65
  • Loading branch information
JoryHogeveen committed Jun 7, 2017
1 parent ef75027 commit 0887ac0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/class-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public static function is_superior_admin( $user_id = null ) {
( null !== $user_id && (int) get_current_user_id() === (int) $user_id ) ? null : $user_id
);

if ( ! $user_id ) {
$store = view_admin_as()->store();
if ( $store->get_curUser() ) {
$user_id = $store->get_curUser()->ID;
}
}

// Is it a super admin and is it one of the manually configured superior admins?
return (bool) ( true === $is_super_admin && in_array( (int) $user_id, self::get_superior_admins(), true ) );
}
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou
* **Feature:** Integration with the "Groups" plugin. Introduces a new view type `groups` when this plugin is activated. [#11](https://github.com/JoryHogeveen/view-admin-as/issues/11)
* **Fix:** auto max height didn't work on frontend. [#55](https://github.com/JoryHogeveen/view-admin-as/issues/55)
* **Fix:** Role Manager used `boolval()` which is only available in PHP 5.5+. [#63](https://github.com/JoryHogeveen/view-admin-as/issues/63)
* **Fix:** `view_admin_as_superior_admins` filter was not working for single installations. [#65](https://github.com/JoryHogeveen/view-admin-as/issues/65)
* **Compatibility:** Allow other plugins to overwrite our `user_has_cap` filter by setting it's priority as first (large negative number). [#56](https://github.com/JoryHogeveen/view-admin-as/issues/56). Thanks to [@pbiron](https://github.com/pbiron) for the report.
* **Compatibility:** Run the `user_has_cap` filter in your `map_meta_cap` filter. [#56](https://github.com/JoryHogeveen/view-admin-as/issues/56)
* **Compatibility:** Add new network capabilities (WP 4.8) to the list. [#64](https://github.com/JoryHogeveen/view-admin-as/issues/64)
Expand Down

0 comments on commit 0887ac0

Please sign in to comment.