Title: Yet another issue with Google
Last modified: February 14, 2020

---

# Yet another issue with Google

 *  [Web Expert](https://wordpress.org/support/users/seldimi/)
 * (@seldimi)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/)
 * Hello. After I’ve tried all suggested solutions, I have come to the same errors
   many people write on forum.
    Legacy People API has not been used in project etc..
 * I have activated Google + Api and People API, thus the problem insists and everytime
   I try to login/sigup, the log.txt shows the same URL
 * Enable it by visiting [https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=20920975420](https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=20920975420)
 * The problem is that the URL is dead and I cannot locate what other APIs I must
   open…

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12445162)
 * Hi there,
    We found the problem and as soon as possible we will send an update.
   Meantime replace the file that you can find at this link [Google.php](https://www.dropbox.com/sh/5zzhosugn7z0rdo/AADXF3jEpEfYRTj2_KL0x5N5a?dl=0),
   in `/wp-content/plugins/yith-woocommerce-social-login-premium/includes/hybridauth/
   Hybrid/Providers/`
 *  Thread Starter [Web Expert](https://wordpress.org/support/users/seldimi/)
 * (@seldimi)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12445354)
 * Great it worked… the only issue I see now is Username invalid and it prompts 
   me to /wp-login.php?ywsl_social=google
    Is it something I still need to work 
   on ?
 * Facebook works great
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12459941)
 * Hi there,
    Does the google email you are using to log in belongs to an account
   already registered?
 *  Thread Starter [Web Expert](https://wordpress.org/support/users/seldimi/)
 * (@seldimi)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12460205)
 * I’ve tried with two different gmail accounts. Both were greek, dunno if that 
   matters for username
 *  [darnpunk](https://wordpress.org/support/users/darnpunk/)
 * (@darnpunk)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12474859)
 * That error shows up likely is due to the displayName being empty. You can add
   these lines below around line 95 within getUserProfile() function in the new 
   Google.php from the post above.
 *     ```
       Line 94: $this->user->profile->zip           = ( property_exists( $response, 'zip' ) ) ? $response->zip : "";
   
       // Add these new lines
       if (  empty($this->user->profile->displayName) ) {
       			$this->user->profile->displayName = $this->user->profile->firstName . " " . $this->user->profile->lastName;
       		}
       ```
   
 * New function should look like
 *     ```
       function getUserProfile() {
       		// refresh tokens if needed
       		$this->refreshToken();
   
       		$response = $this->api->api( "https://www.googleapis.com/oauth2/v3/userinfo" );
       		if ( ! isset( $response ) ) {
       			throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData( $response ), 6 );
       		}
   
       		$this->user->profile->identifier    = ( property_exists( $response, 'sub' ) ) ? $response->sub : "";
       		$this->user->profile->firstName     = ( property_exists( $response, 'name' ) ) ? $response->given_name : "";
       		$this->user->profile->lastName      = ( property_exists( $response, 'name' ) ) ? $response->family_name : "";
       		$this->user->profile->displayName   = ( property_exists( $response, 'displayName' ) ) ? $response->name : "";
       		$this->user->profile->photoURL      = ( property_exists( $response, 'picture' ) ) ? $response->picture : "";
       		$this->user->profile->profileURL    = ( property_exists( $response, 'url' ) ) ? $response->url : "";
       		$this->user->profile->description   = ( property_exists( $response, 'aboutMe' ) ) ? $response->aboutMe : "";
       		$this->user->profile->gender        = ( property_exists( $response, 'gender' ) ) ? $response->gender : "";
       		$this->user->profile->language      = ( property_exists( $response, 'locale' ) ) ? $response->locale : "";
       		$this->user->profile->email         = ( property_exists( $response, 'email' ) ) ? $response->email : "";
       		$this->user->profile->emailVerified = ( property_exists( $response, 'email' ) ) ? $response->email_verified : "";
       		$this->user->profile->phone         = ( property_exists( $response, 'phone' ) ) ? $response->phone : "";
       		$this->user->profile->country       = ( property_exists( $response, 'country' ) ) ? $response->country : "";
       		$this->user->profile->region        = ( property_exists( $response, 'region' ) ) ? $response->region : "";
       		$this->user->profile->zip           = ( property_exists( $response, 'zip' ) ) ? $response->zip : "";
   
       		if (  empty($this->user->profile->displayName) ) {
       			$this->user->profile->displayName = $this->user->profile->firstName . " " . $this->user->profile->lastName;
       		}
   
       		if ( property_exists( $response, 'placesLived' ) ) {
       			$this->user->profile->city    = "";
       			$this->user->profile->address = "";
       			foreach ( $response->placesLived as $c ) {
       				if ( property_exists( $c, 'primary' ) ) {
       					if ( $c->primary == true ) {
       						$this->user->profile->address = $c->value;
       						$this->user->profile->city    = $c->value;
       						break;
       					}
       				} else {
       					if ( property_exists( $c, 'value' ) ) {
       						$this->user->profile->address = $c->value;
       						$this->user->profile->city    = $c->value;
       					}
       				}
       			}
       		}
   
       		// google API returns multiple urls, but a "website" only if it is verified
       		// see http://support.google.com/plus/answer/1713826?hl=en
       		if ( property_exists( $response, 'urls' ) ) {
       			foreach ( $response->urls as $u ) {
       				if ( property_exists( $u, 'primary' ) && $u->primary == true ) {
       					$this->user->profile->webSiteURL = $u->value;
       				}
       			}
       		} else {
       			$this->user->profile->webSiteURL = '';
       		}
       		// google API returns age ranges min and/or max as of https://developers.google.com/+/web/api/rest/latest/people#resource
       		if ( property_exists( $response, 'ageRange' ) ) {
       			if ( property_exists( $response->ageRange, 'min' ) && property_exists( $response->ageRange, 'max' ) ) {
       				$this->user->profile->age = $response->ageRange->min . ' - ' . $response->ageRange->max;
       			} else {
       				if ( property_exists( $response->ageRange, 'min' ) ) {
       					$this->user->profile->age = '>= ' . $response->ageRange->min;
       				} else {
       					if ( property_exists( $response->ageRange, 'max' ) ) {
       						$this->user->profile->age = '<= ' . $response->ageRange->max;
       					} else {
       						$this->user->profile->age = '';
       					}
       				}
       			}
       		} else {
       			$this->user->profile->age = '';
       		}
       		// google API returns birthdays only if a user set 'show in my account'
       		if ( property_exists( $response, 'birthday' ) ) {
       			list( $birthday_year, $birthday_month, $birthday_day ) = explode( '-', $response->birthday );
   
       			$this->user->profile->birthDay   = (int) $birthday_day;
       			$this->user->profile->birthMonth = (int) $birthday_month;
       			$this->user->profile->birthYear  = (int) $birthday_year;
       		} else {
       			$this->user->profile->birthDay   = 0;
       			$this->user->profile->birthMonth = 0;
       			$this->user->profile->birthYear  = 0;
       		}
   
       		return $this->user->profile;
       	}
       ```
   
 *  Thread Starter [Web Expert](https://wordpress.org/support/users/seldimi/)
 * (@seldimi)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12474900)
 * Great thanks.. will that be implemented on next version ?
 *  Plugin Author [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * (@yithemes)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12527075)
 * Hi [@darnpunk](https://wordpress.org/support/users/darnpunk/),
    thanks for your
   suggestion, we’ll send a plugin update with this fix

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Yet another issue with Google’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/yith-woocommerce-social-login_c899b9.
   svg)
 * [YITH WooCommerce Social Login](https://wordpress.org/plugins/yith-woocommerce-social-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yith-woocommerce-social-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yith-woocommerce-social-login/)
 * [Active Topics](https://wordpress.org/support/plugin/yith-woocommerce-social-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yith-woocommerce-social-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yith-woocommerce-social-login/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [YITHEMES](https://wordpress.org/support/users/yithemes/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/yet-another-issue-with-google/#post-12527075)
 * Status: not resolved