bp_members_get_user_nicename( int $user_id )

Return the user_nicename for a user based on their user_id.

Description

This should be used for linking to user profiles and anywhere else a sanitized and unique slug to a user is needed.

Parameters

$user_id

(int) (Required) User ID to check.

Return

(string) The username of the matched user or an empty string if no user is found.

Source

File: bp-members/bp-members-functions.php

function bp_members_get_user_nicename( $user_id ) {
	/**
	 * Filters the user_nicename based on originally provided user ID.
	 *
	 * @since BuddyPress 1.5.0
	 *
	 * @param string $username User nice name determined by user ID.
	 */
	return apply_filters( 'bp_members_get_user_nicename', get_the_author_meta( 'nicename', $user_id ) );
}

Changelog

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