Skip to:
Content

BuddyPress.org

Changeset 2452


Ignore:
Timestamp:
01/25/2010 04:33:09 PM (15 years ago)
Author:
apeatling
Message:

Map data on user creation in wp-admin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-signup.php

    r2300 r2452  
    217217    }
    218218
     219    /* Add a last active entry */
     220    update_usermeta( $user_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
     221
    219222    wp_new_user_notification( $user_id, $user_pass );
    220223
     
    223226    return $user_id;
    224227}
     228
     229function bp_core_map_user_registration( $user_id ) {
     230    /* Only map data when the site admin is adding users, not on registration. */
     231    if ( !is_admin() )
     232        return false;
     233
     234    /* Add a last active entry */
     235    update_usermeta( $user_id, 'last_activity', gmdate( "Y-m-d H:i:s" ) );
     236
     237    /* Add the user's fullname to Xprofile */
     238    if ( function_exists( 'xprofile_set_field_data' ) ) {
     239        $firstname = get_usermeta( $user_id, 'first_name' );
     240        $lastname = ' ' . get_usermeta( $user_id, 'last_name' );
     241
     242        if ( !empty( $firstname ) || !empty( $lastname ) )
     243            xprofile_set_field_data( 1, $user_id, $firstname . $lastname );
     244    }
     245}
     246add_action( 'user_register', 'bp_core_map_user_registration' );
    225247
    226248function bp_core_signup_avatar_upload_dir() {
Note: See TracChangeset for help on using the changeset viewer.