You are here

function cleantalk_user_insert in Anti Spam by CleanTalk 8

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

Implements hook_user_insert().

@FIXME The $edit and $category parameters are gone in Drupal 8. They have been left here in order to prevent 'undefined variable' errors, but they will never actually be passed to this hook. You'll need to modify this function and remove every reference to them.

File

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

Code

function cleantalk_user_insert(\Drupal\user\UserInterface $account) {

  /*if ($category != 'account') {
      return;
    }*/
  $ct_result = _cleantalk_ct_result();
  if (!empty($ct_result['ct_request_id'])) {
    db_insert('cleantalk_uids')
      ->fields(array(
      'uid' => $account
        ->id(),
      'ct_request_id' => $ct_result['ct_request_id'],
      'ct_result_comment' => empty($ct_result['ct_result_comment']) ? '' : $GLOBALS['ct_result_comment'],
    ))
      ->execute();
    _cleantalk_ct_result('set');
  }
}