Skip to:
Content
Pages
Categories
Search
Top
Bottom

xprofile vs usermeta syncing problems


  • Leland
    Participant

    @northcreatif

    I am using the most recent versions of BP and WP and user registration seems to work fine sharing the username and password. How can I make BP import / sync additional usermeta fields? I have custom usermeta fields for my WP install and I create custom xprofile fields but they don’t seem to sync so I have two separate user tables basically. Is there any way I can make sure the xprofile fields update the wordpress usermeta everytime there is a change? or only use 1 table for both?

    I have searched everywhere to get more info on this topic but can’t seem to get anywhere. Also all of the mass user importers for BP 1.2 don’t seem to work with the regular WP install so I’m kind of stumped. I would be happy to sponsor some support help on this. Thanks.

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

  • peterverkooijen
    Participant

    @peterverkooijen

    I’m still on 1.1.3. In 1.1.3 xprofile only gets synchronized with wp_usermeta when the user updates his account, which means you can never count on the data being there, which makes it pointless.

    Lousy synchronization between xprofile and usermeta is not a bug, it’s a conscious design feature. Why? I’ve brought this issue up many times and have never received a clear answer.

    I use a custom function like this below to synchronize member data upon registration into all the different, unconnected places in the database where data is stored:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $uid = get_userdata($user_id);
    $email = $uid->user_email;

    $fullname = $meta[field_1];

    ... whatever you need here ....

    update_usermeta( $user_id, 'nickname', $fullname );
    update_usermeta( $user_id, 'first_name', $firstname );
    update_usermeta( $user_id, 'last_name', $lastname );

    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) );
    $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $user_id ), $user_id ) );
    }
    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    Not sure if this still works in 1.2. I had posted my work-arounds under ‘FAQ: How To, Code Snippets and Solutions’, but they have been deleted. So I guess they solved the issues in 1.2?

    To synch xprofile you’d need to create the fields in xprofile that you have in wp_usermeta and then do something backwards like the above function, if that hook etc. is still valid.

    Solution: upgrade.


    peterverkooijen
    Participant

    @peterverkooijen

    @Andy Peatling, so version 1.2 does sync separate firstname and lastname from the xprofile field to the fields in wp_usermeta?

    I will upgrade when WP 3.0 is out, probably this Summer when my day job work is slow. I have a custom theme. It will be a complicated operation.


    Leland
    Participant

    @northcreatif

    What can I do make sure the xprofile data gets updated when register new users in WP? I am using a standard WP install and the most up to date BP install. I am using the mass user registration plugin to generate WP users – it fills in a username, first name, last name, etc. but all standard wp_usermeta values (nothing custom). I need to make sure that when a user is registered it also copies that data to the xprofile. I think John Jacoby wrote a plugin for that at one time in Jan but his download no longer works. Any help greatly appreciated. Thank you.

    I might be able to sponsor some help if that is required.


    Leland
    Participant

    @northcreatif

    bump.


    mpvanwinkle77
    Member

    @mpvanwinkle77

    I would love to hear an overall rationale for why BP still uses xprofile instead of the standard wp_usermeta system. If it’s just a relic maybe some of use would be willing to contribute code to move beyond it? I know I would.


    notorioushttp
    Participant

    @alfred3x

    I’m starting a custom plugin to migrate users from a custom community site to WP/BP. Wondering whether I need to worry about xProfiles, or can just use usermeta. I’ve been hunting for documentation which might explain the difference between the two. Any help greatly appreciated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘xprofile vs usermeta syncing problems’ is closed to new replies.
Skip to toolbar