|
|
|
/** |
|
* Link account to user |
|
* |
|
* @param string $provider |
|
* @param object $getUserProfile |
|
* @param string $returnUrl |
|
* @param boolean $has_linked_account |
|
* |
|
* @since 2.2 |
|
*/ |
|
function um_033022_social_link_user_to_social( $provider, $getUserProfile, $returnUrl, $has_linked_account = false ){ |
|
|
|
update_user_meta( um_user('ID'), "_um_social_login_avatar_provider", $provider ); |
|
|
|
$getUserProfile->photoURL = str_replace( "width=150", "width=200", $getUserProfile->photoURL ); |
|
|
|
$getUserProfile->photoURL = str_replace( "height=150", "height=200", $getUserProfile->photoURL ); |
|
|
|
update_user_meta( um_user('ID'), "synced_profile_photo", $getUserProfile->photoURL ); |
|
|
|
$arr_profile = array( |
|
"_uid_{$provider}" => $getUserProfile->identifier, |
|
"_save_{$provider}_handle" => $getUserProfile->displayName, |
|
"_save_{$provider}_photo_url_dyn" => $getUserProfile->photoURL, |
|
"_save_{$provider}_photo_url" => $getUserProfile->photoURL, |
|
"_save_{$provider}_link" => $getUserProfile->profileURL, |
|
"_save_synced_profile_photo" => $getUserProfile->photoURL, |
|
"username_exists" => $getUserProfile->email, |
|
"email_exists" => $getUserProfile->email, |
|
"_save_{$provider}_raw_data" => (array)$getUserProfile, |
|
); |
|
|
|
UM()->Social_Login_API()->user_connect()->save_user_meta( um_user('ID'), $arr_profile, $provider ); |
|
} |
|
add_action("um_social_do_link_user","um_033022_social_link_user_to_social", -1, 4 ); |