bp_core_get_user_displayname( int|string|bool $user_id_or_username )

Fetch the display name for a user.


Parameters Parameters

$user_id_or_username

(int|string|bool) (Required) User ID or username.


Top ↑

Return Return

(string|bool) The display name for the user in question, or false if user not found.


Source Source

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

function bp_core_get_user_displayname( $user_id_or_username ) {
	if ( empty( $user_id_or_username ) ) {
		return false;
	}

	if ( ! is_numeric( $user_id_or_username ) ) {
		$user_id = bp_core_get_userid( $user_id_or_username );
	} else {
		$user_id = $user_id_or_username;
	}

	if ( empty( $user_id ) ) {
		return false;
	}

	/**
	 * Filters the display name for the passed in user.
	 *
	 * @since 1.0.1
	 *
	 * @param string $fullname Display name for the user.
	 * @param int    $user_id  ID of the user to check.
	 */
	return apply_filters( 'bp_core_get_user_displayname', get_the_author_meta( 'display_name', $user_id ), $user_id );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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