function antispam_user_insert in AntiSpam 7
Implements hook_user_insert().
1 call to antispam_user_insert()
- antispam_user_update in ./
antispam.module - Implements hook_user_update().
File
- ./
antispam.module, line 1556 - Primary hook implementations for the Antispam module.
Code
function antispam_user_insert(&$edit, $account, $category) {
$moderator_email_for_options = _antispam_get_email_for_options();
$moderator_types = antispam_get_moderator_types($account);
$moderator_types_count = count($moderator_types);
if ($moderator_types_count > 0 && isset($edit['antispam_moderator_email_for'])) {
if (!isset($moderator_email_for_options[$edit['antispam_moderator_email_for']])) {
$edit['antispam_moderator_email_for'] = 'approval';
}
$result = db_query("SELECT * FROM {antispam_moderator} WHERE uid=:uid", array(
':uid' => $account->uid,
));
if ($result
->rowCount()) {
// update
db_update('antispam_moderator')
->fields(array(
'email_for' => $edit['antispam_moderator_email_for'],
))
->condition('uid', $account->uid)
->execute();
}
else {
// insert
db_insert('antispam_moderator')
->fields(array(
'uid' => $account->uid,
'email_for' => $edit['antispam_moderator_email_for'],
))
->execute();
}
$edit['antispam_moderator_email_for'] = NULL;
}
}