Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Inline documentation says 'Drupal sends emails whenever new users register on your site, and optionally, may also notify users after other account actions.', but it's not optional - e-mails are sent unconditionally. It'd be nice to have a checkbox per e-mail template to allow/disallow this e-mail sending : i'm going to import a batch of users, keeping their login/pass, i don't want each of them to receive a "your account has been created" mail.
In the meantime, i'm just going to comment drupal_mail calls in ldapprov.module, but it's a ugly hack.
Comment | File | Size | Author |
---|---|---|---|
#4 | ldapprov-checkbox-mail.diff | 17.88 KB | landry |
#3 | ldapprov-checkbox-mail.diff | 16.41 KB | landry |
Comments
Comment #1
landry CreditAttribution: landry commentedAny news on that issue ?
What about adding a checkbox for each e-mail to conditionally send it, or if it's too complicated maybe send it only if the subject is not empty.. that'd be nice to avoid flooding users with e-mails when doing batch imports on them.
Comment #2
landry CreditAttribution: landry commentedSo, more on this, i started hacking on that..
For the 5 email to send, only send if if subject is not empty, with something like :
It works fine.. but the caveat is that if you set the subject for a given mail to an empty string, and save, it is correctly saved :
but if you reload the configuration form, the default value is set back by the _ldapprov_mail_text() call.. as it is an empty string the following test at line 334 fails :
So.. i'm not really sure the 'send only if subject is not null' is the better way to go.
Miglius, what do you think about it ? Are you interested in a full patch ? I'll see if i can make a proof-of-concept with an enable/disable checkbox for each e-mail..
Comment #3
landry CreditAttribution: landry commentedSo it wasn't that hard.. here's a new working patch, at least for me :
- add 5 boolean variables ldapprov_mail_$key_enable defaulting to TRUE
- add a checkbox for each variable on the admin interface
- only send the e-mail if the corresponding variable is TRUE (corresponding code is reindented)
- remove the variables upon uninstall
Moving status to 'needs review' accordingly..
Comment #4
landry CreditAttribution: landry commentedWhoops.. attached wrong patch. Here's the correct one.