You are here

function cleantalk_user_presave in Anti Spam by CleanTalk 7.2

Same name and namespace in other branches
  1. 8 cleantalk.module \cleantalk_user_presave()
  2. 7 cleantalk.module \cleantalk_user_presave()

Implements hook_user_presave().

File

./cleantalk.module, line 1423
Main CleanTalk integration module functions.

Code

function cleantalk_user_presave(&$edit, $account, $category) {
  $ct_result = _cleantalk_ct_result();
  if ($account->is_new && @empty($ct_result['ct_request_id'])) {
    $spam_check = array();
    $spam_check['type'] = 'register';
    $spam_check['sender_email'] = !empty($_POST['mail']) ? $_POST['mail'] : '';
    $spam_check['sender_nickname'] = !empty($_POST['name']) ? $_POST['name'] : '';
    $spam_result = _cleantalk_check_spam($spam_check);
    if (isset($spam_result) && is_array($spam_result) && $spam_result['errno'] == 0 && $spam_result['allow'] != 1) {
      _cleantalk_die($spam_result['ct_result_comment']);
    }
  }
}