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 https://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;
}