Replies
- This reply has been marked as private.
- This reply has been marked as private.
- This reply has been marked as private.
Thanks again Brajesh. I appreciate your responsiveness.
I’m definitely not adding it.
I want to hide the Joined date and the username over the cover photo. It seems making it display the Company Name over the cover photo is apparently a big deal so for a Company I’d rather it just not show anything. But then it will hide it for everyone which is preferable to it looking like this.I don’t want it to look like company-name for the Company name over the cover photo. Do you have any ideas how to make a custom field being company_name be the display name? I’ve spent weeks and hit a dead end. There is a plug in which does it from memberfix but then when you go to edit a profile either as admin or the user it gives you an error that formatting for the username must be lower-lower and won’t let you save it.
I don’t use Elementor. I used to in other sites but it was too bulky and hard to get it out of it. I use Generate Press for everything now.
Any ideas would be much appreciated.
Sorry I didn’t do a good job of explaining my question.
I mean can the link be dynamic for the profile being displayed?In other words, if I have a page for that particular user which is just a regular page not in the BB system, how would I make the link dynamic or is that not possible?
Hi,
Thank you for the response!In other words, did I create a field in the fields option of BB settings? If so, yes. So when they register, if they are a company, they have a field for Company Name.
I’ve been looking at these options but not sure what to change:
From a previous forum topic:
https://buddypress.org/support/topic/how-to-set-display_name-xprofile-custom_field-at-the-user-registration/add_action( ‘bp_core_activated_user’, ‘change_user_defaults’, 99, 3 );
function change_user_defaults($user_id, $key, $user) {if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}if (empty($user_id)) {
return false;
}$mv_first_name = xprofile_get_field_data(26, $user_id);
$mv_last_name = xprofile_get_field_data(11, $user_id);
$name = $mv_first_name . ‘ ‘ . $mv_last_name;if ($name !== ‘ ‘) {
$args = array(
‘ID’ => $user_id,
‘display_name’ => $name
);
wp_update_user($args);
}
}______
Or
http://hookr.io/functions/bp_get_member_name/_________
Or
https://www.buddyboss.com/resources/reference/functions/bp_get_member_name/function bp_get_member_name() {
global $members_template;// Generally, this only fires when xprofile is disabled.
if ( empty( $members_template->member->fullname ) ) {
// Our order of preference for alternative fullnames.
$name_stack = array(
‘display_name’,
‘user_nicename’,
‘user_login’
);foreach ( $name_stack as $source ) {
if ( !empty( $members_template->member->{$source} ) ) {
// When a value is found, set it as fullname and be done with it.
$members_template->member->fullname = $members_template->member->{$source};
break;
}
}
}$list_fields = bp_xprofile_get_hidden_fields_for_user( $members_template->member->ID, bp_loggedin_user_id() );
if ( empty( $list_fields ) ) {
$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;
$full_name = str_replace( ‘ ‘ . $last_name, ”, $members_template->member->fullname );
} else {
$full_name = $members_template->member->fullname;
}
}/**
* Filters the display name of current member in the loop.
*
* @since BuddyPress 1.2.0
*
* @param string $fullname Display name for current member.
*/
return apply_filters( ‘bp_get_member_name’, trim( $full_name ) );
}Seems like that’s around the topic but I don’t know what to tweak. I do have Snippets installed so easy to drop it in if I could get some help with the code.
Thank you so much in advance! Surely other people want to be able to use a profile field and Display Name?
What would be even better is if:
IF there is a company name, then display that (meta field from xprofile field), and if not let the user choose from First Name, First/Last or nickname. Is that possible?- la on September 2, 2021 at 1:12 am in reply to: Make Custom Profile Tab specific to specific Profile? #40348
Hi Brajesh,
Thank you for the reply.As for #2 you mentioned: the problem with that (I have installed it and spent quite a bit of time with it) it only lets you control the content displayed by role. That doesn’t do me any good. I need the content (a shortcode for a formidable form) to be relevant only for the profile displayed. I’m convinced there must be a way to solve this.
As for #1 you suggested:
1. If you have a shortcode that accepts user id, you can use our tag replacement feature for it.
You can change
[som-shortcode user_id=32]
to
[some-shortcode user_id=”#displayed_user_id#”]Can you explain that in more detail? How would I create the tag replacement?
That sounds hopeful! I’ll check to see if the form shortcode allows for user_id.Thank you!