You are here

function logintoboggan_user_update in LoginToboggan 7

Implement hook_user_update().

File

./logintoboggan.module, line 1100
LoginToboggan module

Code

function logintoboggan_user_update(&$edit, $account, $category) {

  // Only perform this check if an admin is editing the account.
  if (user_access('administer users') && isset($edit['roles'])) {

    // Check to see if roles present, and the pre-auth role was present when
    // the form was initially displayed.
    if (isset($edit['logintoboggan_pre_auth_check'])) {

      // If the pre-auth is set to the auth user, then no further checking is
      // necessary.
      $validating_id = logintoboggan_validating_id();
      $pre_auth = !variable_get('user_email_verification', TRUE) && $validating_id != DRUPAL_AUTHENTICATED_RID;
      if ($pre_auth) {

        // Check to see if an admin has manually removed the pre-auth role from
        // the user. If so, send the account activation email.
        if (!isset($edit['roles'][$validating_id]) || !$edit['roles'][$validating_id]) {

          // Mail the user, letting them know their account now has auth user perms.
          _user_mail_notify('status_activated', $account);
        }
      }
    }
  }
}