Hello. Your plugin is good, but there is a problem. It only changes the isername reference.
I use buddyboss and there, when editing a profile, personal data, a nickname is set.
And when you change the username through your plugin, then only the wordpress username changes, and the nickname in the profile remains the old one.
You have to change both the username and nickname twice.
Is there some hook so that when changing the username, the nickname in the member’s profile also changes?
Hi Alex,
Thank you for the question.the plugin is not aimed at changing user nice names. It allows changing the username(the name used to login).
Please see the name of the plugin. It specifically says that “Username” not anything else. I can add a hook for the same but BuddyBoss nick names need to be unique(and unless you want the username to be nickname), It is going to be a problem.
Please let me know if you still need the hook? I will add.
Regards
BrajeshOn the contrary, i want the nickname to be the same as the username.
Just so that when the username changes, the nickname also changes.
As you understand, now need to change it 2 times – first the username, then change the nickname in editing the profile.
Please write a hook, i’ll try what happens.
Hi Alex,
I had a look at the code.we are already updating the nicename
https://github.com/sbrajesh/bp-username-changer/blob/master/bp-change-username.php#L157
and here is the hook you are loooking for
https://github.com/sbrajesh/bp-username-changer/blob/master/bp-change-username.php#L200
Hope that helps.
Regards
BrajeshHello. So what do i need to add to the function file? So that when i change the username, the nickname also changes?
Below are 2 screenshots. When changing the username, the nickname remains old in the user profile under the avatar, the old nickname @john is displayed. Although i changed my username to john2.
Hello Alex,
Try the following code:
add_action( 'bp_username_changed', function ( $new_username, $user_data, $user ) { // BB uses the nickname in the mentioned name. update_user_meta( $user->ID, 'nickname', $new_username ); if ( bp_is_active( 'xprofile' ) ) { // To update nicename field. // Replace 3 with your nicename field id. xprofile_set_field_data( 3, $user->ID, $new_username ); } }, 10, 3 );
Please check and let me know if it helps
Regards
RaviThanks, it worked. Is it possible to apply a hook so that when changing the nickname, the username changes? Do the same back?
Because sometimes someone changes their nickname in the profile settings and you still need to change the username.
And so, with any changes, either the nickname or the username will change in both cases.
use AardvarkVersion: 4.50
after user name change not redirecting page to new username , return to same page , and page not found error,
not redirecting to new username link.
You must be logged in to reply to this topic.