role_at_least() false for super admin
-
Had an issue where the broadcast post meta box isn’t showing on the main blog of our WPMU but is on the others. I’m logged in as super admin.
I took a look and the
create_meta_box()
method in ThreeWP_Broadcast.php calls$this->role_at_least( 'author' )
which is returning false.The
role_at_least()
method in ThreeWP_Broadcast_Base.php gets all the way to the bottom then fails on isset( $current_user->allcaps[ $role_cap ] ) which returns false – remember that I’m logged in as super admin.The method only calls is_super_user() (which returns true btw) if the role passed is ‘super_admin’. IMO this should be called if the function exists regardless of the role passed. Here is my updated version of the method:
public function role_at_least($role) { global $current_user; wp_get_current_user(); if ( $current_user === null ) return false; if ($role == '') return true; if ( function_exists('is_super_admin') && is_super_admin() ) return true; if ($role == 'super_admin') return false; // This was previously done by current_user_can, but for some reason it doesn't work all the time in WP3.5. // So now I have to check "manually", which probably means that filters are rendered ineffective. $role_cap = $this->roles[$role]['current_user_can']; return isset( $current_user->allcaps[ $role_cap ] ) && $current_user->allcaps[ $role_cap ] == true; }
https://www.ads-software.com/extend/plugins/threewp-broadcast/
- The topic ‘role_at_least() false for super admin’ is closed to new replies.