You are here

function location_user_user_load in Location 7.3

Same name and namespace in other branches
  1. 7.4 location_user.module \location_user_user_load()

Implements hook_user_load().

@todo Make this load all locations at once instead of running separate queries for each user to enhance performance. location_load_locations() and location_load_location() will need changing to make this happen.

File

./location_user.module, line 61
Associate locations with users.

Code

function location_user_user_load($users) {
  foreach ($users as $uid => $user) {
    $users[$uid]->locations = location_load_locations($user->uid, 'uid');
    $users[$uid]->location = count($users[$uid]->locations) ? $users[$uid]->locations[0] : array();
  }
}