Skip to:
Content
Pages
Categories
Search
Top
Bottom

Losing first and last name fields


  • tom durocher
    Participant

    @tdurocher

    I’m using BBpress for forums and Buddypress for forum profile features and in future would like to use more BuddyPress features. My problem is that if a user changes their forum name, it is changes the first name account field to the forum name and clears out the last name account field. If I uncheck the Buddypress setting “Sync with profile fields” this does not occur but the forum name does not change at all. I don’t mind syncing forum name with “display name” but the first and last name fields can’t be wiped out. I know I must be doing something wrong but can’t find it. I’m also using Memberpress for registration.

Viewing 19 replies - 1 through 19 (of 19 total)

  • tom durocher
    Participant

    @tdurocher

    Wow, I’ve just discovered that if I deactivate Buddypress, I can change all the account fields: first name, last name, nickname AND display name. This is what I want with Buddypress enabled and I see that it works this way on this forum here, but I can’t see what I have done in Buddypress to break this.


    Marcus Harris
    Participant

    @limousineking

    Waiting for your response to fix my website


    tom durocher
    Participant

    @tdurocher

    Doesn’t look like anybody’s going to help us here, Marcus. If I find the answer, other than getting rid of Buddypress, I’ll let you know. Please do the same for me if you find an answer. So far I have come up empty.


    David Cavins
    Keymaster

    @dcavins

    Hi @tdurocher-

    What screen are you using to change the bbPress “forum name”? (That’s unfamiliar to me.)

    BuddyPress uses the user’s profile to manage names, and doesn’t generally interact with the First and Last name fields; it allows the user to manage the Display Name field. For instance, via http://bptest.local/members/admin/profile/edit/group/1/

    Adding MemberPress to the mix complicates the issue somewhat, too.


    tom durocher
    Participant

    @tdurocher

    Ah, thanks for the response. The url I’m using is, for example, https://masteringid.com/members/testmember/profile/edit/group/1/, which produces the following form:
    Edit Profile
    Editing “Forum username” Profile Group
    Name (required)

    This field may be seen by: Everyone
    Forum Signature

    Note that I have changed “base profile” to “forum username” as it seemed more to the point. So I think this is the page you are referring to but there is no Display Name field shown. I don’t so much need the First and Last Name fields as the display name field, because, although changing the forum username will change the display name, it also changes the First and Last Name (through the “Sync with WP profile” checkbox.

    BBpress alone shows First Name, Last Name, Nickname, and the Display Name dropdown. If I could have the Nickname and Display Name fields, or even just the Display Name field, I think I’d be okay.


    tom durocher
    Participant

    @tdurocher

    David (@dcavins), do you have any ideas why I wouldn’t be seeing the Display Name under Edit Profile, as you said it should? Or why Buddypress overrides important BBpress fields for editing the forum profile? I think there must be a way around this. I do not see that Memberpress is involved in this profile page at all (no apparent mepr classes or js shown in developer tools). Thanks very much for any help.


    David Cavins
    Keymaster

    @dcavins

    Hi Tom-

    I’d guess that you (or the previous site admin) edited the Display Name field to be called “Name.” You can check by visiting this screen on your installation: /wp-admin/users.php?page=bp-profile-setup

    “Display Name” is usually the first profile field created, so if you inspect the input, and it has the name=field_1, then you can guess that your “Name” field is the “Display Name” field I’m talking about, just renamed, similar to how you renamed the “Base profile.” It sounds like when you’re talking about “Forum Name” you’re talking about BP’s Base Profile > Display Name, but with your own naming convention.

    I also was wrong about the synchronization between Display Name and First and Last name. If I update the Display Field to be “Too Slim”, the WP First Name will become “Too” and the WP Last Name will become “Slim,” assuming that “Enable BuddyPress to WordPress profile syncing” (s you said). The WordPress “Display Name” field will become “Too Slim.” The WP “Display Name” is also looks like what is used by bbPress in its loops.

    So, if you want your users to be able to change the name used by the bbPress forums, you’ll need to have “Enable BuddyPress to WordPress profile syncing” checked. Then, the WP “Display Name” field is updated when the BP “Display Name” field is checked. If you want to leave WP’s First and Last Name fields to not be synced after sign-up, the following code could be added to your bp-custom.php file or wherever you keep your customization code:

    
    // Remove BP's action because it syncs nickname, display_name, first_name and last_name.
    remove_action( 'xprofile_data_after_save', 'xprofile_sync_wp_profile_on_single_field_set' );
    function my_custom_xprofile_sync_wp_display_name_only_on_single_field_set( $user_id = 0 ) {
    	// Bail if profile syncing is disabled.
    	if ( bp_disable_profile_sync() ) {
    		return true;
    	}
    
    	if ( empty( $user_id ) ) {
    		$user_id = bp_loggedin_user_id();
    	}
    
    	if ( empty( $user_id ) ) {
    		return false;
    	}
    
    	$fullname = xprofile_get_field_data( bp_xprofile_fullname_field_id(), $user_id );
    
    	bp_update_user_meta( $user_id, 'nickname',   $fullname  );
    
    	wp_update_user( array( 'ID' => $user_id, 'display_name' => $fullname ) );
    }
    add_action( 'xprofile_data_after_save', 'my_custom_xprofile_sync_wp_display_name_only_on_single_field_set' );
    

    It’s a modified version of this function, leaving the first and last name logic out: https://github.com/buddypress/BuddyPress/blob/5.0.0/src/bp-xprofile/bp-xprofile-functions.php#L803


    tom durocher
    Participant

    @tdurocher

    Thanks for your answer. I believe it will work for me but it may take me a day or two to check it all out.


    tom durocher
    Participant

    @tdurocher

    Hi David,

    I have tried out your code and there’s a problem. But first, to address your question about the “name” field, when I’m talking about Forum Name I am talking about the Group (which had been called Base Profile). That is what I changed to Name, for UX reasons. However, I see that the field I’m calling “Name” is field_1 so probably I did change it from Display Name to Name but, as I think you know, that is not the problem.

    Regarding the code you gave me, that did solve the problem of not updating the WP First and Last name fields. However, it also prevented changes to the forum name or display name or whatever you want to call the name in the Forum Profile. I’m tempted to try commenting out the line:

    bp_update_user_meta( $user_id, 'nickname', $fullname );

    but I’m working on a live site with quite a bit of action and got a little spooked that I might change everybody’s existing posts/names, so for now I’ve just removed all your code.

    Thanks,
    Tom


    tom durocher
    Participant

    @tdurocher

    Hi @dcavins. Just @mentioning you in case you’re not subscribed. I think you code can work for me if we can just get the Forum name back to being savable.

    After looking at the original function in the link you posted, I’m guessing that updating the nickname with $fullname is not wrong, but it doesn’t seem to be working. I notice that this function in the original code is attached to two actions that are different than the one you had me attach to. Could this be the problem? Remember, I have removed the original xprofile_sync function.

    add_action( 'bp_core_signup_user',      'xprofile_sync_wp_profile' );
    add_action( 'bp_core_activated_user',   'xprofile_sync_wp_profile' );
    

    Thanks,
    Tom


    David Cavins
    Keymaster

    @dcavins

    Hi Tom-

    It sounds like you have a lot of balls in the air. For instance:

    Remember, I have removed the original xprofile_sync function.

    Honestly, I can’t know enough about your setup to tell you anything for sure. What I can tell you is this:

    • bbPress uses WordPress’s “Display Name” field, not a BuddyPress field.
    • BuddyPress only updates the WP “Display Name” field when profile syncing is enabled.
    • BP’s default sync function also updates WP’s “First Name” and “Last Name”
    • The replacement function I provided updates WP’s “Display Name” but _not_ the “First Name” and “Last Name” fields.

    Feel free to comment out the “nickname” update line. You won’t hurt anything. You’ll just not update the BP “nickname” field. Which won’t affect the name bbPress displays.


    tom durocher
    Participant

    @tdurocher

    @dcavins, when I say I removed the xprofile_sync function, that was part of your suggested code. More precisely, I removed the function from the action and then added your revised function. I guess that should not prevent the forum name from being set and yet it apparently does. Well, your bullet items are good info, especially that first one. I will look at this again.

    What IS the BP nickname field, if it doesn’t use that? Maybe I’ll need to ask on the bbpress forum. Thanks again, I’ll see what I can do with this information. I’m starting to smell my theme being involved.


    David Cavins
    Keymaster

    @dcavins

    Sorry, it’s not the BP nickname field. That’s actually a WP user meta field.

    Other things that appear to be true:
    • BP uses WP’s “Display Name” to label the user in activity items and elsewhere.
    • WP’s ‘nickname’ meta is required but not used widely?

    So it seems like the key field for display in BP, bbPress and WP is WP’s “display name” field.

    Ha! Names are confusing!


    tom durocher
    Participant

    @tdurocher

    Yeah. To make in even more confusing WP offers the ability to set the display_name to any of the other names (nickname, first name last name, username, and more) – I think it is username by default. Well I’ve learned something about WP’s and BP’s use of names, so maybe that will help me figure out what is going wrong with the xprofile function you sent me. It is failing to update the (apparently one single) display name. Maybe bbpress does NOT user display name for its “forum name”. Anyway, I’m missing something about the the BBPress/Buddypress integration with regard to names. Unfortunately, this is not the highest priority thing I’m working on….


    David Cavins
    Keymaster

    @dcavins

    Note that you will have to have “Enable BuddyPress to WordPress profile syncing” checked in order for the function I provided to work.

    Also, “WP offers the ability to set the display_name to any of the other names (nickname, first name last name, username, and more)”, yes that’s true, but when your preference is saved, the value you chose is copied into the “display_name” field in the wp_user database, so don’t get distracted by that issue–it’s still the WP “display_name” that bbPress and BuddyPress care about.


    bahadir kozbinay
    Participant

    @rolandoaka

    Nike The Puma Company Clyde The Courtroom Zapatillas de deporte POE Joyride Su zapatos Champion mujer baratas invento viene con 1, 000 gotas asignadas durante una serie de almohadas dentro de la suela exterior, brindando el mayor acolchado adicional sobre el remachado. Este tipo de gotas de espuma de poliuretano se adapta a casi cualquier base; Las zapatillas de deporte ECCO en las rebajas de descuento solo piensan en descansar en una butaca muy elegante que, a su vez, se ajusta lentamente en la forma del cuerpo de uno, después de lo cual, como si nunca te sintieras erguido, no experimentarás Zapatillas Adidas Yung-96 Chasm similares a tener esta zapatilla específica fuera.


    bahadir kozbinay
    Participant

    @rolandoaka

    Inoltre, Adidas Deborah. E. E. Matter # 1 sneaker sembra essere una nuova fascia per i piedi per mantenere il flusso d’aria Nike Massima misura Tasso Riproduzione della posizione delle sneaker di superficie per una maggiore stabilità.Quasi nessun dato può essere acquistato, tuttavia abbiamo sperimentato come Scarpe Nike Classic Cortez Nylon Premium coinvolgere le sneaker Adidas ZX500 RM Sort 8 potrebbe alleviare il coinvolgimento di Late e 12 sneaker Nike Internationalist LT17 2019.Resta sintonizzato per ulteriori informazioni su WearTester. relativo a Speak Sbarazzarsi di 80 cambi di sneaker OX per quanto riguarda la tecnica di Sort 8 di Dwyane Wade.Il tuo negozio online di sneaker Reebok Reebok Reply 5 può essere l’ultima varietà di 60 ‘insieme a noi’ abbiamo esposto la ricerca insieme alla valutazione dei modi di colore delle sneaker assicurative nazionali White / Power Crimson Vehicles Strong National.


    krogerf
    Participant

    @krogerf

    I have seen many sites offering some additional cashbacks and promocodes. Though there are many other sites like mybkexperience and kfcexperience, I love to participate in krogerfeedback which is the best survey taking site for all it’s kroger stores. You can also participate in the survey to receive 50$ coupon and extra fuel points.


    bahadir kozbinay
    Participant

    @rolandoaka

    Musen i Gel-Lyte ble laget via Asics Solyte polyuretanskum. Dette øker også fordi sneakers yttersåle ved hjelp av betydelig skrape silikon inkludert i hele ansette deler i redusere rask don. Min ektefelle og jeg likte skumblandingen din med respons og ekstra polstring som ga Palladium skoene tilbud din sneaker en fin opplevelse. Fold grooves klare plassen virkelig den eneste Asics Kayano løpesko modell som gir vei opp ren frihet sammen med aktivitet samt fantastisk smidighet rundt skrånende materialer. Virkelig det eneste problemet med dette for deg til disse typer spor kan være at de kan oppnå pickup-smuss og slippes ut. En ny retning Range, samt straight groove, jogging varigheten av virkelig den eneste gjør at du kan øke gangproduktivitet, sammen med øker den rene aktiviteten sammen med produktiviteten i sneaker.

Viewing 19 replies - 1 through 19 (of 19 total)
  • You must be logged in to reply to this topic.
Skip to toolbar