I am trying to update a BuddyBoss Profile when a users wordpress profile is updated in the user edit page from the backend/admin. (Basically I want to sync the data). I have this function:

function BB_WP_SYNC_update_BB_profile( $user_id ) {
        // Get user information    
     $country = get_user_meta($user_id, 'ofc_country', true);
     $region = get_user_meta($user_id, 'ofc_regional_organisation', true);
     $gender = get_user_meta($user_id, 'ofc_gender', true);
     $dob = get_user_meta($user_id, 'ofc_date_of_birth', true);
     $timestamp = strtotime(str_replace('/', '-', $dob));

     $date = date('Y-m-d H:i:s', $timestamp);

     //Update BuddyBoss Profile
     xprofile_set_field_data('Country', $user_id, $country, true);
     xprofile_set_field_data('Regional Organisation', $user_id, $region, true);
     xprofile_set_field_data('Gender', $user_id, $gender, true);
     xprofile_set_field_data('Date of Birth', $user_id, $date, true);

add_action( 'edit_user_profile_update', 'BB_WP_SYNC_update_BB_profile');
add_action( 'personal_options_update', 'BB_WP_SYNC_update_BB_profile');

The user information this function gets is the old information, prior to it being updated. For example, if I change the Country from Australia to Tahiti, then $country in my function is set to Australia.

I have to click the update profile button a second time for it to get the new value (which has obviously been set from the first click), and then it updates BuddyBoss correctly.

It seems that 'edit_user_profile_update' & 'personal_options_update' hook in before the user meta fields are updated.

Is there something else I can use to ensure both user meta fields & user fields are updated before the hook fires?

1 Answer 1


For anyone else with this issue, the fix was simple. I changed the hook and most importantly, I changed the priority so my action comes later. Default wordpress priority was 10, so I set priority to 11 and it works.

add_action( 'profile_update', 'BB_WP_SYNC_update_BB_profile', 11, 2);

And my function changed due to the different hook:

function BB_WP_SYNC_update_BB_profile( $user_id, $old_user_data ) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.