Skip to content

Commit

Permalink
correct null country error for linkedin
Browse files Browse the repository at this point in the history
The previous commit invoke $linkedinuser->country->code instead of $linkedinuser->location->country->code, generating a null value if no googleipinfodbkey is configured.
The database column "country" is not null, then the update operation will fail, resulting in inconsistent user info.
Here I correct the source of informations and only set value if is not empty.
  • Loading branch information
kmiksi committed Mar 18, 2014
1 parent 5ef293e commit b9a66bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@ function loginpage_hook() {
case 'linkedin':
$newuser->firstname = $linkedinuser->firstName;
$newuser->lastname = $linkedinuser->lastName;
$newuser->country = $linkedinuser->country->code;
$newuser->city = $linkedinuser->name;
if (!empty($linkedinuser->location->country->code)) {
$newuser->country = $linkedinuser->location->country->code;
}
if (!empty($linkedinuser->location->name)) {
$newuser->city = $linkedinuser->location->name;
}
break;

default:
Expand Down

0 comments on commit b9a66bb

Please sign in to comment.