abuse_admin_ban_user

Definition

abuse_admin_ban_user($uid)
abuse/abuse.admin.inc, line 441

Code

<?php
function abuse_admin_ban_user($uid) {
  global $user;
  $account = user_load(array('uid' => $uid));
  $status = FALSE;
  $message = 'User @name could not be banned.';
  if ($user->uid > 1 && $user->uid !== $account->uid) {
    abuse_remove_account_content($account);
    sess_destroy_uid($uid);
    db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', 'mail', 0)", $account->mail);
    db_query("INSERT INTO {access} (mask, type, status) VALUES ('%s', 'user', 0)", $account->mail);
    db_query("UPDATE {users} SET status=0 WHERE uid=%d", $account->uid);
    $status = TRUE;
    $message = "The user @name has been banned.";
  }
  return array('status' => $status, 'data' => t($message, array('@name' => $account->name)));
}
?>