Changeset 2818 for branches/1.2/bp-xprofile.php
- Timestamp:
- 03/08/2010 03:28:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-xprofile.php
r2794 r2818 888 888 * @package BuddyPress Core 889 889 */ 890 function xprofile_sync_wp_profile( ) {890 function xprofile_sync_wp_profile( $user_id = false ) { 891 891 global $bp, $wpdb; 892 892 … … 894 894 return true; 895 895 896 $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id ); 896 if ( empty( $user_id ) ) 897 $user_id = $bp->loggedin_user->id; 898 899 if ( empty( $user_id ) ) 900 return false; 901 902 $fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $user_id ); 897 903 $space = strpos( $fullname, ' ' ); 898 904 … … 905 911 } 906 912 907 update_usermeta( $ bp->loggedin_user->id, 'nickname', $fullname );908 update_usermeta( $ bp->loggedin_user->id, 'first_name', $firstname );909 update_usermeta( $ bp->loggedin_user->id, 'last_name', $lastname );910 911 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $ bp->loggedin_user->id ) );912 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $ bp->loggedin_user->id ), $bp->loggedin_user->id ) );913 update_usermeta( $user_id, 'nickname', $fullname ); 914 update_usermeta( $user_id, 'first_name', $firstname ); 915 update_usermeta( $user_id, 'last_name', $lastname ); 916 917 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) ); 918 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $user_id ), $user_id ) ); 913 919 } 914 920 add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' ); 915 921 add_action( 'bp_core_signup_user', 'xprofile_sync_wp_profile' ); 916 922 917 923 /**
Note: See TracChangeset
for help on using the changeset viewer.