bp_core_get_userid( string $username = '' )

Return the user ID based on a user’s user_login.


Parameters Parameters

$username

(string) (Optional) user_login to check.

Default value: ''


Top ↑

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 );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.