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

Do not send email notification to the user if notify is not set in the params #21562

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

jitendrapurohit
Copy link
Contributor

Overview

Do not send email notification to the user if notify is not set in the params

Before

Create User sends email notification even if $params['notify'] is set to FALSE.

After

Email is sent only if $params['notify'] = true;

Technical Details

Spotted a ToDo comment in D8 file -

@todo: Should we only send off emails if $params['notify'] is set?

which i think is yes, since we have the same implementation in D7 and Backdrop - https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/System/Drupal.php#L40

@civibot
Copy link

civibot bot commented Sep 21, 2021

(Standard links)

@civibot civibot bot added the master label Sep 21, 2021
@demeritcowboy
Copy link
Contributor

This looks ok just I can't see any place that notify ever gets set? The useradd form doesn't have an option for notify, profiles send the email via CRM_Core_BAO_UFGroup::commonSendMail not passing on "notify", etc. So I think this would end up never sending an email.

Was there a page where you noticed this?

@jitendrapurohit
Copy link
Contributor Author

Yes, and is the same process that we've used with d7 from a long time? Eg, I don't see any emails sent in d7 when a user is created from action dropdown on a contact summary page.

I checked a bit more and seems register_no_approval_required and register_pending_approval is not dependent on this param. It is only admin notification register_admin_created that is avoided when notify is set to false on register form - /admin/people/create.

image

I've updated the PR to ignore notify for register_no_approval_required and register_pending_approval.

@demeritcowboy
Copy link
Contributor

Yeah I think maybe the drupal 7 code is weird. This code doesn't get called from /admin/people/create, and there's nowhere in civi I can find that sets the param corresponding to that checkbox that is on the (drupal) form. So $params['notify'] is always empty. It would make sense to me to ADD a field called notify to the civi user add form that mimics the one on the drupal form, but that's a bigger PR.

So I dunno. I guess this PR makes it closer to how drupal 7 + civi works, whether that's right or wrong.

@demeritcowboy demeritcowboy added the merge ready PR will be merged after a few days if there are no objections label Sep 22, 2021
@demeritcowboy demeritcowboy merged commit be3dd90 into civicrm:master Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants