You are here

function advuser_user_insert in Advanced User 5.2

Same name and namespace in other branches
  1. 5 advuser.module \advuser_user_insert()
  2. 6.2 advuser.module \advuser_user_insert()
  3. 7.3 advuser.module \advuser_user_insert()

Handle user insertion (new users)

1 call to advuser_user_insert()
advuser_user in ./advuser.module
hook_user implementation

File

./advuser.module, line 556
Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.

Code

function advuser_user_insert($edit, $user, $category) {

  // Check to see if we notify the administrator of new users.
  // Only send if the user isn't created by an administrator.
  $new_notify = variable_get('advuser_new_notify', FALSE) && !user_access('administer_users');
  if ($new_notify) {
    $from = variable_get("site_mail", ini_get("sendmail_from"));
    $body = variable_get('advuser_new_mail', NULL);
    $subject = variable_get('advuser_new_subject', NULL);

    // these are invariant for all sent emails
    $variables = _advuser_get_variables($user);
    $user_subject = strtr($subject, $variables);
    $user_body = strtr($body, $variables);
    watchdog('advuser', "Sending user account mail: subj='{$user_subject}' body='{$user_body}'");
    _advuser_mail_roles($user_subject, $user_body, $from);
  }
}