abuse_admin_warn_user($type, $oid, $subject = NULL, $body = NULL, $op = 'allow')
abuse/abuse.admin.inc, line 412
<?php
function abuse_admin_warn_user($type, $oid, $subject = NULL, $body = NULL, $op = 'allow') {
global $user, $language;
$object = _abuse_load($type, $oid);
$status = FALSE;
$message = t('Sorry, the user could not be warned and the operation could not be carried out');
if ($object->oid) {
$account = user_load(array('uid' => $object->uid));
$to = check_plain($account->name) ."<$account->mail>";
$params = array();
$params['object'] = $object;
$params['account'] = $account;
$params['subject'] = (isset($subject)) ? $subject : variable_get('abuse_warn_subject', t('Abuse warning'));
$params['body'] = (isset($body)) ? $body : variable_get('abuse_warn_body', '');
$params['bcc'] = variable_get('abuse_warn_bcc', '');
drupal_mail('abuse', 'warning_email', $to, $language, $params);
db_query("INSERT INTO {abuse_warnings} (type, oid, created, uid, sent_by_uid) VALUES ('%s', %d, %d, %d, %d)",
$type, $oid, time(), $account->uid, $user->uid);
if ('allow' == $op) {
_abuse_allow($object->type, $object->oid);
}
elseif ('remove' == $op) {
_abuse_remove($object->type, $object->oid);
}
$status = TRUE;
$message = t('Your message has been sent.');
}
return array('status' => $status, 'data' => $message);
}
?>