bp_core_get_userid( string $username = '' )
Return the user ID based on a user’s user_login.
Description Description
Parameters Parameters
- $username
-
(Optional) user_login to check.
Default value: ''
Return Return
(int|null) The ID of the matched user on success, null on failure.
Source Source
File: bp-members/bp-members-functions.php
function bp_core_get_userid( $username = '' ) {
if ( empty( $username ) ) {
return false;
}
$user = get_user_by( 'login', $username );
/**
* Filters the ID of a user, based on user_login.
*
* @since 1.0.1
*
* @param int|null $value ID of the user or null.
* @param string $username User login to check.
*/
return apply_filters( 'bp_core_get_userid', ! empty( $user->ID ) ? $user->ID : NULL, $username );
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |