function role_expire_user_view in Role Expire 7
Same name and namespace in other branches
- 8 role_expire.module \role_expire_user_view()
- 2.x role_expire.module \role_expire_user_view()
Implements hook_user_view().
File
- ./
role_expire.module, line 507 - Role Expire module
Code
function role_expire_user_view($account, $view_mode) {
global $user;
if (user_access('administer role expire') || user_access('administer users') || $user->uid == $account->uid) {
$roles = array();
$expiry_roles = role_expire_get_all_user_records($account->uid);
foreach ($account->roles as $key => $val) {
if (array_key_exists($key, $expiry_roles)) {
$roles[$key] = t("%role role expiration date: %timedate", array(
'%role' => ucfirst($val),
'%timedate' => format_date($expiry_roles[$key]),
));
}
}
if ($roles) {
$account->content['summary']['role_expire'] = array(
'#type' => 'user_profile_item',
'#title' => t('Role expiration'),
'#markup' => theme('item_list', array(
'items' => $roles,
)),
'#attributes' => array(
'class' => array(
'role-expiry-roles',
),
),
);
}
}
}