hook_user_load

Versions
7
hook_user_load($users)

Act on user objects when loaded from the database.

Due to the static cache in user_load_multiple() you should not use this hook to modify the user properties returned by the {users} table itself since this may result in unreliable results when loading from cache.

See also

user_load_multiple()

@see profile_user_load()

Parameters

$users An array of user objects, indexed by uid.

Related topics

Code

modules/user/user.api.php, line 26

<?php
function hook_user_load($users) {
  $result = db_query('SELECT * FROM {my_table} WHERE uid IN (:uids)', array(':uids' => array_keys($users)));
  foreach ($result as $record) {
    $users[$record->uid]->foo = $result->foo;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.