function user_registrationpassword_uninstall in User registration password 8
Same name and namespace in other branches
- 6 user_registrationpassword.install \user_registrationpassword_uninstall()
- 7 user_registrationpassword.install \user_registrationpassword_uninstall()
Implements hook_uninstall().
File
- ./
user_registrationpassword.install, line 60 - Install file.
Code
function user_registrationpassword_uninstall() {
// Load configurations.
$user_config = \Drupal::configFactory()
->getEditable('user.settings');
$user_mail_config = \Drupal::configFactory()
->getEditable('user.mail');
$mail_original_config = \Drupal::configFactory()
->getEditable('user_registrationpassword.mail_original');
// Reset system variables back to save defauls.
$user_config
->set('register', UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)
->set('verify_mail', 1)
->set('notify.register_pending_approval', 1)
->set('notify.register_no_approval_required', 1)
->save();
// Load original stored activation mail variables.
$original_subject = $mail_original_config
->get('status_activated.subject');
$original_body = $mail_original_config
->get('status_activated.body');
// Reset the stored activation mail template if available.
if (!empty($original_subject) && !empty($original_subject)) {
$user_mail_config
->set('status_activated.subject', $original_subject)
->set('status_activated.body', $original_body)
->save();
}
}