function user_revision_load in User Revision 7
Same name and namespace in other branches
- 7.2 user_revision.module \user_revision_load()
Load a revision.
Loads a user object with revision support
2 calls to user_revision_load()
- user_revision_show in ./
user_revision.module - Show a revision.
- user_revision_user_delete in ./
user_revision.module - Implements hook_user_delete().
File
- ./
user_revision.module, line 336 - Enables user revision.
Code
function user_revision_load($uid, $vid = NULL, $reset = FALSE) {
if (isset($vid)) {
$conditions = isset($vid) ? array(
'vid' => $vid,
) : array();
$users = user_load_multiple(array(
$uid,
), $conditions, $reset);
foreach ($users as $key => $user) {
$fid = db_select('user_revision', 'ur')
->condition('ur.vid', $vid)
->fields('ur', array(
'picture',
))
->execute()
->fetchField();
if ($fid) {
$file = new stdClass();
$file->fid = $fid;
$users[$key]->picture = file_load($file->fid);
}
}
return reset($users);
}
}