Hi Robert
This did not work for me.I am trying to hide the display name altogether. Did you find a solution?
Regards
Mike
Hi Mike,
I don’t think that you can entirely remove the xProfile name field from BuddyPress (Even with the plugin that is available). So I decided why fight it? I cloned the WP username. The only potential problem with this is that the WP username is public – I used a plugin to force stronger WP username and passwords to help with this.
Here is the base of what I did:
– On the registration form hide the xProfile name field (CSS display: none) and make a javascript listener (CHANGE) function to change the xProfile name field to the value of the WP username. This will take care of the form validation – xProfile name field is required. See reference…
– For the edit your profile section I hide the xProfile name field, I also included a PHP function that made the value of this equal to the WP username, in the state that a user was added from the dashboard. (I did not provide PHP, I essentially grabbed WP logged in username…) – You can also display the xProfile name field input as readonly (add attribute: readonly).
Now all xProfile name field instances in BP are the same as the WP user.
Reference:
jQuery(‘input#signup_username’).change(function () {
jQuery(‘input#field_1’).val(jQuery(this).val());
});
Thank Robert. I will take a look into this. I am sort of getting the hang of things with BP. I have Wishlist Member running on the site so registration is through a custom registration form, no BP registration. This has caused me some headaches because WLM does not integrate fully with BP.
Thanks again for your reply and your time.Much appreciated.
Mike
@Robert thank you for the reference. I’m actually looking something like this. great tips
i found this somewhere online after hours of searching! wored for me… add to functions.php
function my_member_username() {
global $members_template;
return $members_template->member->user_login;
}
add_filter( 'bp_member_name' , 'my_member_username' );
function my_bp_displayed_user_fullname() {
global $bp;
return $bp->displayed_user->userdata->user_login;
}
add_filter( 'bp_displayed_user_fullname' , 'my_bp_displayed_user_fullname' );