function sharedemail_user in Shared Email 5
Same name and namespace in other branches
- 6 sharedemail.module \sharedemail_user()
Implementation of hook_user().
File
- ./
sharedemail.module, line 75 - Allows users to share an email address
Code
function sharedemail_user($type, &$edit, &$user, $category = NULL) {
$mail = $edit['mail'];
if ($type == 'validate' && !user_validate_mail($mail)) {
// Only show warning message if more than 1 user with the same email
if (db_num_rows(db_query("SELECT uid FROM {users} WHERE uid != %d AND LOWER(mail) = LOWER('%s')", $user->uid, $edit['mail'])) > 0) {
$edit['mail'] = 'sharedemail_' . $mail;
// Show warning text to those with the permission selected
if (user_access('show warning text')) {
drupal_set_message(variable_get('sharedemail_msg', ''));
}
}
}
}