function ip2country_user_load in IP-based Determination of a Visitor's Country 8
Same name and namespace in other branches
- 7 ip2country.module \ip2country_user_load()
Implements hook_user_load().
Takes care of restoring country data from {users_data}.
File
- ./
ip2country.module, line 125 - Determination of user's Country based on IP.
Code
function ip2country_user_load($accounts) {
foreach ($accounts as $account) {
$userdata = \Drupal::service('user.data')
->get('ip2country', $account
->id(), 'country_iso_code_2');
if (isset($userdata)) {
$accounts[$account
->id()]->country_iso_code_2 = $userdata;
}
}
}