diff options
Diffstat (limited to 'modules/user/user.api.php')
-rw-r--r-- | modules/user/user.api.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/user/user.api.php b/modules/user/user.api.php index 4d7feef77..6e3515d3b 100644 --- a/modules/user/user.api.php +++ b/modules/user/user.api.php @@ -84,6 +84,25 @@ function hook_user($op, &$edit, &$account, $category = NULL) { return $form; } } +/** + * 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. + * + * @param $users + * An array of user objects, indexed by uid. + * + * @see user_load_multiple() + * @see profile_user_load() + */ +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; + } +} /** * Act on user account cancellations. |