You are here

function user_registrationpassword_admin_settings_submit in User registration password 6

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

Submit handler for the user admin form.

1 string reference to 'user_registrationpassword_admin_settings_submit'
user_registrationpassword_form_user_admin_settings_alter in ./user_registrationpassword.module
Implements hook_form_FORM_ID_alter() for the user administration form.

File

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

Code

function user_registrationpassword_admin_settings_submit(&$form, &$form_state) {
  $value = $form_state['values']['user_registrationpassword_registration'];
  if ($value == USER_REGISTRATIONPASS_VERIFICATION_PASS) {
    variable_set('user_email_verification', 0);

    // Prevent standard notification email to administrators and to user
    // When user_register is set to 1, else send the e-mail by default.
    if ($form_state['values']['user_register'] == 1 && $form_state['values']['user_registrationpassword_registration'] != 1) {
      variable_set('user_mail_register_pending_approval_notify', 0);
      variable_set('user_mail_register_no_approval_required_notify', 0);
      drupal_set_message('User Registration Password Enabled', 'warning');
    }
    else {
      variable_del('user_mail_register_pending_approval_notify');
      variable_set('user_mail_register_no_approval_required_notify', 0);
      drupal_set_message('User Registration Password Disabled', 'warning');
      drupal_set_message('Don\'t forget, you also need to change your Account activation e-mail template again to include a one-time login link so the user can login again, because you selected \'Visitors can create accounts but administrator approval is required.\' at <b>Public registrations: </b>.');
    }
  }
  else {
    variable_set('user_email_verification', (int) $value);

    // Let default value.
    // @see _user_mail_notify()
    variable_del('user_mail_register_pending_approval_notify');
    variable_del('user_mail_register_no_approval_required_notify');
    drupal_set_message('User Registration Password Disabled', 'warning');
    drupal_set_message('Don\'t forget, you also need to change your Account activation e-mail template again to include a one-time login link so the user can login again, because you selected \'Visitors can create accounts but administrator approval is required.\' at <b>Public registrations: </b>.');
  }
}