More efficient is_super_admin(). Don't call new WP_User on the current user. props mdawaffe, fixes #14842.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4850c82d1c
commit
ca725961c5
|
@ -1213,15 +1213,13 @@ function get_super_admins() {
|
|||
* @return bool True if the user is a site admin.
|
||||
*/
|
||||
function is_super_admin( $user_id = false ) {
|
||||
if ( ! $user_id ) {
|
||||
$current_user = wp_get_current_user();
|
||||
$user_id = ! empty($current_user) ? $current_user->id : 0;
|
||||
}
|
||||
|
||||
if ( ! $user_id )
|
||||
return false;
|
||||
|
||||
if ( $user_id )
|
||||
$user = new WP_User( $user_id );
|
||||
else
|
||||
$user = wp_get_current_user();
|
||||
|
||||
if ( empty( $user->id ) )
|
||||
return false;
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$super_admins = get_super_admins();
|
||||
|
|
Loading…
Reference in New Issue