You are here

function user_registrationpassword_user in User registration password 6

Implements hook_user().

File

./user_registrationpassword.module, line 296
Enables password creation on registration form.

Code

function user_registrationpassword_user($op, &$edit, &$account, $category = NULL) {

  // Test if we are on the user register page and not on an admin page.
  // The only downside of this, is that we have to run this check on every user
  // account form. Sad thing, fixed in D7. If anyone knows a better way, patch!
  // If we'r loading the user object, the user is never logged in, but
  // registered (and the module is enabled obviously), set
  // $account->status to 0, else users will log in and the default welcome
  // e-mail is send next to ours.
  // Also tested this while activating/blocking/deleting a user via the admin
  // interface, all still seems to work ok, but more_contrib_modules_tests++.
  if ($op == 'load' && $account->login == 0 && $account->access == 0 && $account->uid > 1 && variable_get('user_register', 0) == 1 && variable_get('user_registrationpassword_registration', USER_REGISTRATIONPASS_VERIFICATION_PASS) == USER_REGISTRATIONPASS_VERIFICATION_PASS) {
    $account->status = 0;
  }
}