function show_email_user_view in Show Email Address 7
Implements hook_user_view().
File
- ./
show_email.module, line 52 - Basically show the user's registered email address.
Code
function show_email_user_view($account, $view_mode, $langcode) {
foreach ($account->roles as $key => $role) {
// This will only show hidden roles to compare them.
if (variable_get('show_email_settings_hide_per_role_' . $key) == 1) {
$hidden_roles[$key] = $role;
}
}
if (variable_get('show_email_enabled', 1) == 1 && user_access('access to show email') && empty($hidden_roles) && $account->uid > 1 || $account->uid == 1 && variable_get('show_email_settings_hide_uid_one') == 0 && empty($hidden_roles)) {
$account->content['field_email'] = array(
'#theme' => 'field',
'#weight' => variable_get('show_email_weight', 100),
'#field_type' => 'text',
'#view_mode' => $view_mode,
'#label_display' => variable_get('show_email_label_display', 'inline'),
'#field_name' => 'field_email',
'#entity_type' => 'user',
'#bundle' => 'main',
'#title' => t('Email'),
'#items' => array(
array(
'value' => $account->mail,
),
),
0 => array(
'#markup' => l($account->mail, 'mailto:' . $account->mail),
),
);
}
}