TUTORIAL Proper names for users registered with Social Login (e.g. Vkontakte)

2.93K viewsUpdates

Not all providers in WordPress Social Login (officially recommended for AnsPress) return proper data. For vk.com provider (russian facebook) it was returning user id as “display name”.

This display name issue can be fixed with simple snippet:

function d_change_display_name( $user_id ) {
    $info = get_userdata( $user_id );
	$args = array(
		'ID' => $user_id,
		'display_name' => $info->first_name . ' ' . $info->last_name
    wp_update_user( $args );