BP_Core_Follow_Following_Widget::get_user_display_name( $user_id )

Display user name to ‘First Name’ when they have selected ‘First Name & Last Name’ in display format.

Description

Source

File: bp-core/classes/class-bp-core-follow-following-widget.php

	public function get_user_display_name( $user_id ) {

		if ( ! $user_id ) {
			return;
		}

		$format = bp_get_option( 'bp-display-name-format' );

		if (
			'first_name' === $format
			|| 'first_last_name' === $format
		) {
			$first_name_id = (int) bp_get_option( 'bp-xprofile-firstname-field-id' );
			$display_name = xprofile_get_field_data( $first_name_id, $user_id );
		} else {
			$display_name = bp_core_get_user_displayname( $user_id );
		}

		return apply_filters( 'bp_core_widget_user_display_name', $display_name, $user_id );
	}

Changelog

Changelog
Version Description
BuddyBoss 1.2.5 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.