How to set display_name = xprofile ‘custom_field’ at the user registration
-
Hi, everybody!
Could you help me to set set display_name = xprofile ‘first_name’ + ‘last_name’ at the user registration?
I’ve tryed this code:function change_user_defaults($user_id) { $user = get_userdata($user_id); $mv_first_name = xprofile_get_field_data( 26, $user_id ); $mv_last_name = xprofile_get_field_data( 11, $user_id ); $name = $mv_first_name . ' ' . $mv_last_name; $mv_login = $user_id . stristr($user->user_email, '@', true); if ($name !== ' '){ $args = array( 'ID' => $user_id, 'display_name' => $name ); wp_update_user( $args ); } } add_action( 'xprofile_updated_profile', 'change_user_defaults' ); /* but this works only after manual BuddyPress profile update */ /* I also tried these hooks too */ add_action( 'bp_core_signup_user', 'change_user_defaults' ); add_action( 'bp_core_activated_user', 'change_user_defaults' ); /* but it didn't work at the user registration */
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.