bp_core_get_userid_from_nickname( string $nickname )
Return the user ID based on nickname.
Description
Parameters
- $nickname
-
(string) (Required) nickname to check.
Return
(int|null) The ID of the matched user on success, null on failure.
Source
File: bp-members/bp-members-functions.php
function bp_core_get_userid_from_nickname( $nickname ) { if ( empty( $nickname ) ) { return false; } $users = get_users( [ 'meta_key' => 'nickname', 'meta_value' => $nickname, 'number' => 1, 'count_total' => false ] ); $user = $users ? $users[0] : null; return apply_filters( 'bp_core_get_userid_from_nickname', ! empty( $user->ID ) ? $user->ID : null, $nickname ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.