bp_core_get_userid_from_nicename( string $user_nicename = '' )

Return the user ID based on user_nicename.

Description

Parameters

$user_nicename

(Optional) user_nicename to check.

Default value: ''

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_nicename( $user_nicename = '' ) {
	if ( empty( $user_nicename ) ) {
		return false;
	}

	$user = get_user_by( 'slug', $user_nicename );

	/**
	 * Filters the user ID based on user_nicename.
	 *
	 * @since BuddyPress 1.2.3
	 *
	 * @param int|null $value         ID of the user or null.
	 * @param string   $user_nicename User nicename to check.
	 */
	return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename );
}

Changelog

Changelog
Version Description
BuddyPress 1.2.3 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.