Skip to content

Commit

Permalink
Introduce is_super_admin() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Sep 3, 2024
1 parent aad9d24 commit 08abba6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/General/Current_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,28 @@ public function create_nonce( string $action ): string {
public function verify_nonce( string $nonce, string $action ): bool {
return (bool) wp_verify_nonce( $nonce, $action );
}

/**
* Retrieves the current user's display name.
*
* @since n.e.x.t
*
* @return string The current user's display name.
*/
public function display_name(): string {
return wp_get_current_user()->display_name;
}

/**
* Checks whether the current user is a super admin.
*
* By default, super admins have access to all capabilities, unless explicitly denied to everyone.
*
* @since n.e.x.t
*
* @return bool True if the user is a super admin, false otherwise.
*/
public function is_super_admin(): bool {
return is_super_admin();
}
}

0 comments on commit 08abba6

Please sign in to comment.