Skip to:
Content
Pages
Categories
Search
Top
Bottom

New users xprofile data being lost

  • @nicholmikey

    Participant

    Hello,

    I have a large user base (7000+ users) and recently there have been problems when new users register. Users fill in their xprofile data and sign up, get an activation key in the mail, but when they click the activation link the page either comes back with a 502 Bad Gateway or a blank page. Turning on debug mode still results in the blank page. After this, users get an email saying they are activated, but all of their xprofile data is gone and their name is replaced with their username. I am under a really tight deadline to fix this and am pulling my hair out, any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @nicholmikey

    Participant

    I see this in my server logs, may be related “

    `2011/09/01 10:20:54 [error] 26045#0: *49560 readv() failed (104: Connection reset by peer) while reading upstream, client: 10.101.63.159, server: 10.77.8.199, request: “GET /activate?key=2f3c8e6084ce8bc7 HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9119”, host: “10.77.8.199”`

    @nicholmikey

    Participant

    So this is what happened, the plugin “Multisite User Management” has a hook that fires when you make a new user in order to automatically assign users roles to certain blogs. This all worked fine in my dev environment, but on my production site the plugin took so long that it would crash PHP during the activation process. I fixed this by disabling that plugin. Now I was left with 80+ users that were missing their xprofile data and passwords that they set, as the script crashed before it could get to that point. (no data being copied to xprofile tables). I fixed their profiles by selecting damaged users from the wp_signups table and running the code from bp-core-signup.php that was missed due to crashes.

    This code updates all users from the 20th of august to today (the date range of the problem)

    `
    <?php

    require( dirname(__FILE__) . ‘/wp-load.php’ );
    global $bp, $wp, $wpdb;

    $users = $wpdb->get_results( “SELECT * FROM wp_signups WHERE registered > ‘2011-08-22 00:00:00′”);

    $user_id = $user;

    foreach ($users as $dbuser){

    echo $dbuser->user_login . ‘
    ‘;
    $meta = unserialize($dbuser->meta);
    $user_login = $wpdb->escape($dbuser->user_login);
    $user_email = $wpdb->escape($dbuser->user_email);
    $password = wp_generate_password( 12, false );
    $user_id = username_exists($user_login);

    $user = array(‘blog_id’ => ‘0’, ‘user_id’ => $user_id, ‘password’ => $password, ‘title’ => $signup->title, ‘meta’ => $meta);

    if ( function_exists( ‘xprofile_set_field_data’ ) ) {
    if ( !empty( $user ) ) {
    $profile_field_ids = explode( ‘,’, $user );

    foreach( (array)$profile_field_ids as $field_id ) {
    $current_field = $user[“field_{$field_id}”];

    if ( !empty( $current_field ) )
    xprofile_set_field_data( $field_id, $user_id, $current_field );
    }
    }
    }

    /* Update the user_url and display_name */
    wp_update_user( array( ‘ID’ => $user_id, ‘user_url’ => bp_core_get_user_domain( $user_id, sanitize_title( $user_login ), $user_login ), ‘display_name’ => bp_core_get_user_displayname( $user_id ) ) );

    /* Add a last active entry */
    update_user_meta( $user_id, ‘last_activity’, bp_core_current_time() );

    /* Set the password on multisite installs */
    if ( bp_core_is_multisite() && !empty( $user ) )
    $wpdb->query( $wpdb->prepare( “UPDATE $wpdb->users SET user_pass = %s WHERE ID = %d”, $user, $user_id ) );

    /* Delete the total member cache */
    wp_cache_delete( ‘bp_total_member_count’, ‘bp’ );

    }

    echo ‘all done’;

    ?>
    `

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘New users xprofile data being lost’ is closed to new replies.
Skip to toolbar