Advertisements

is_super_admin

Definition:
function is_super_admin( $user_id = false ) {}

Determine if user is a site admin.

Parameters

  • int $user_id: (Optional) The ID of a user. Defaults to the current user.

Return values

returns:True if the user is a site admin.

Source code

function is_super_admin( $user_id = 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();

		if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) )

			return true;

	} else {

		if ( $user->has_cap('delete_users') )

			return true;

	}



	return false;

}

2197

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: