BuddyPress Syncing with Wordpress Profile

I have BuddyPress with BP XProfile WordPress User Sync to get First and Last names and trying to get them to sync to the Wordpress profile. The developer of BP XProfile WordPress User Sync won't support me since I'm using Membership/Buddypress and he claims there's a conflict there. Any chance you can remedy this for me? I just want to add First and Last Names at registration and I cannot seem to get this done.

  • Vaughan
    • Support/SLS MockingJay

    Hi @schoolofbookkeeping.com,

    Hope you're well?

    This is a known issue, I keep reading about it, but we never found a solution. I can see on a thread here the developer mentions membership needs some hooks/actions for it, let me just flag one of our SLS guys for some of his expertise.


    Hopefully he might be able to get to the bottom of it, but if it requires some hooks, it may need to go as a feature request depending on how complex it is.

    Hope this helps

  • astUtemy
    • New Recruit

    Thanks @Vaughan. Interestingly, if you open the user's extended profile and click update, it pushes the first and last to the WP profile. So, whatever is making that happen, can't someone write some code to make this automatic? It just can't be that difficult.

  • Jose
    • Bruno Diaz

    Hi there @schoolofbookkeeping.com,

    Hope you are doing great.

    I'm not sure why the developer claims for a conflict. As per what I can see, there are enough hooks to achieve what you need.

    If you use the Membership pop up registration form, I'm almost sure that it will work out of the box.
    (didn't test though).
    For the standard registration, I made a custom Must-use plugin that should workaround the issue.
    You only need to drop the attached plugin into the folder ../wp-content/mu-plugins/ (create the folder if it doesn't exists).

    Just for reference, this is the code into the must-use plugin:

    if(! class_exists('sync_xprofile') ):
        class sync_xprofile{
            function __construct(){
                add_action( 'membership_subscription_form_registration_process', array( $this, 'on_membership_subscription_form_registration_process'), 10, 2);
            function on_membership_subscription_form_registration_process( $errors, $user_id ){
                global $bp_xprofile_wordpress_user_sync;
                $bp_xprofile_wordpress_user_sync->intercept_wp_profile_sync($user_id, null, false);
                // Make sure the User Meta is updated with the xprofile name
                $data = explode( ' ', xprofile_get_field_data( 'Name', $user_id, 'array' ) );
                $firstname = array_shift( $data );
                $lastname = implode( ' ', $data );
                update_user_meta( $user_id, 'first_name', $firstname );
                update_user_meta( $user_id, 'last_name', $lastname );
        new sync_xprofile;

    Please give it a try and let me know if I'm missing something.


  • Jose
    • Bruno Diaz

    Are you using the standard Membership registration form?

    I'll be glad to take a look directly in your site.

    Please send me the following information via contact form :

    - In the subject field add "Attn: Jose”
    - Link back to this thread
    - Include WP admin/network access
    - Include FTP host and credentials.

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.


  • Jose
    • Bruno Diaz

    I'll wait for the FTP details.
    I need to add some debug traces into the code and doing so via the dashboard editor is not a good idea. If I make any mistake, it will break the site and I wouldn't be able to roll it back.
    This is something that I learned years ago in the hard way :wink:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.