Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #18 #19

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions profile.module
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ function profile_form_validate_handler(&$form, &$form_state) {
* @see profile_attach_form()
*/
function profile_form_before_user_register_submit_handler(&$form, &$form_state) {
global $conf;
$config = config('system.core');

// List of available operations during the registration.
$register_ops = array('register_admin_created', 'register_no_approval_required', 'register_pending_approval');
Expand All @@ -764,12 +764,12 @@ function profile_form_before_user_register_submit_handler(&$form, &$form_state)
foreach ($register_ops as $op) {

// Save variable value.
if (isset($conf['user_mail_' . $op . '_notify'])) {
$changed_ops['user_mail_' . $op . '_notify'] = $conf['user_mail_' . $op . '_notify'];
if ($config->get('user_mail_' . $op . '_notify')) {
$changed_ops['user_mail_' . $op . '_notify'] = $config->get('user_mail_' . $op . '_notify');
}

// Temporary disable the notification about registration.
$conf['user_mail_' . $op . '_notify'] = FALSE;
$config->set('user_mail_' . $op . '_notify', FALSE);
}
}

Expand All @@ -785,7 +785,7 @@ function profile_form_before_user_register_submit_handler(&$form, &$form_state)
* @see profile_attach_form()
*/
function profile_form_after_user_register_submit_handler(&$form, &$form_state) {
global $conf;
$config = config('system.core');

// List of registration operations that where
// notification values were changed.
Expand All @@ -798,11 +798,11 @@ function profile_form_after_user_register_submit_handler(&$form, &$form_state) {
// If we changed the notification value in
// profile_form_before_user_register_submit_handler() then change it back.
if (isset($changed_ops['user_mail_' . $op . '_notify'])) {
$conf['user_mail_' . $op . '_notify'] = $changed_ops['user_mail_' . $op . '_notify'];
$config->set('user_mail_' . $op . '_notify', $changed_ops['user_mail_' . $op . '_notify']);
}
// Otherwise just remove this value from a global variables array.
else {
unset($conf['user_mail_' . $op . '_notify']);
$config->set('user_mail_' . $op . '_notify', TRUE);
}
}

Expand Down