In your 'User Explorer' there is data stating "Login from United Kingdom"
How can I save this country data into the users wordpress profile when they log in to my site?
you can start with a hook like this:
The data that you are looking for is in
The following code works when registering a new user, though I wonder is it possible to update the country field every time a user logs in?
// Handle data retrieved from a social network profile
function oa_social_login_store_extended_data ($user_data, $identity)
// $user_data is an object that represents the newly added user
// The format is similar to the data returned by $user_data = get_userdata ($user_id);
// $identity is an object that contains the full social network profile
$userid = $user_data->ID;
$gender = $identity->gender;
$birthday = $identity->birthday;
// $locale = $identity->currentLocation;
$logincountry = $identity->loginLocation->country->short;
// Store the gender
update_user_meta ($userid, 'wpcf-user-demographic-gender', $gender);
// Store The Birthday
update_user_meta ($userid, 'wpcf-user-demographic-birthday', $birthday);
// Store The Country
update_user_meta ($userid, 'wpcf-user-demographic-locale', $logincountry);
// This action is called whenever Social Login adds a new user
add_action ('oa_social_login_action_after_user_insert', 'oa_social_login_store_extended_data', 10, 2);
for this you can use the following action/hook:
In the variable
you can also find other properties like for example the ip address or the full country name.
Great, that's looks like it's worked so I have just one more question...
If I understand correctly this country data is taken from the IP, which is outside of the social network being logged into?
I ask so that I know how to define our web privacy terms and app requests from facebook.
Yes, the country is based on the IP address.
Please sign in to your OneAll account to take part in the discussions.
Please click on the link below to connect to the forum with your OneAll account.