Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROD-8526] - Fixed wrong display name when shown to a disconnected user. #4606

Open
wants to merge 3 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bp-members/bp-members-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,8 @@ function bp_get_member_name() {
$full_name = $members_template->member->fullname;
} else {
$last_name_field_id = bp_xprofile_lastname_field_id();
if ( in_array( $last_name_field_id, $list_fields ) ) {
$last_name = $members_template->member->fullname;
if ( in_array( $last_name_field_id, $list_fields ) && ! empty( xprofile_get_field_data( $last_name_field_id, $members_template->member->ID ) ) ) {
$last_name = xprofile_get_field_data( $last_name_field_id, $members_template->member->ID );
$full_name = str_replace( ' ' . $last_name, '', $members_template->member->fullname );
} else {
$full_name = $members_template->member->fullname;
Expand Down
2 changes: 1 addition & 1 deletion src/bp-xprofile/bp-xprofile-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ function xprofile_filter_get_user_display_name( $full_name, $user_id, $current_u
if ( ! empty( $list_fields ) ) {
$last_name_field_id = bp_xprofile_lastname_field_id();

if ( in_array( $last_name_field_id, $list_fields ) ) {
if ( in_array( $last_name_field_id, $list_fields ) && ! empty( xprofile_get_field_data( $last_name_field_id, $user_id ) ) ) {
$last_name = xprofile_get_field_data( $last_name_field_id, $user_id );
$full_name = str_replace( ' ' . $last_name, '', $full_name );
}
Expand Down