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.
Thanks for this module. I'm currently implementing this for a customer.
On unsubscribe it seems unnecessary to require the name. Just the e-mail should do. The user might not even remember the name he/she registered with.
Could you make "name required" a setting?
(Even nicer would be to adjust the requirement based on the subscribe/unsubscribe toggle, but this would need some javascript magic.)
Comment | File | Size | Author |
---|---|---|---|
#15 | simplenews_realname.6.x-1.x.956684_04.patch | 1.29 KB | sgabe |
#7 | simplenews_realname.6.x-1.x.956684_03.patch | 2.88 KB | sgabe |
#2 | simplenews_realname.6.x-1.x.956684_02.patch | 2.83 KB | sgabe |
#2 | simplenews_realname.6.x-2.x.956684_01.patch | 2.47 KB | sgabe |
#1 | simplenews_realname.956684_01.patch | 1.74 KB | sgabe |
Comments
Comment #1
sgabe CreditAttribution: sgabe commentedSure, absolutely. This can be easily done with Chaos tool suite's dependent tool and some modification based on Skip Validation. The attached patch hides the "Name" field and skips the validation on unsubscription. Please, test it and report back.
Note that you need to install and enable Chaos tool suite to toggle the visibility of the "Name" field!
Comment #2
sgabe CreditAttribution: sgabe commentedCommitted to both branches.
Note that the visibility toogle for the "Name" field works only in the 1.x branch, since only that uses radios to choose to subscribe or unsubscribe. However the "Name" field is not validated as required field if the user choose to unsubscribe from a newsletter.
See the patches attached to easier review, but you can test the development snapshots.
Comment #3
gaele CreditAttribution: gaele commentedThanks. I'll test tomorrow, when the new dev snapshots are published.
Comment #4
gaele CreditAttribution: gaele commentedHi, I tested with 6.x-1.x.dev. Showing/hiding the Name field seems to work as expected. However I encountered two bugs.
- logged in: after subscribing followed by unsubscribing the corresponding row in table simplenews_realname is not deleted.
- not logged in: subscribing yields this error: warning: mail() expects parameter 1 to be string, array given in [...]/includes/mail.inc on line 193.
Comment #5
sgabe CreditAttribution: sgabe commentedAbout the first one, were you subscribed for multiple newsletters?
Comment #6
gaele CreditAttribution: gaele commentedNo, only one newsletter is available.
Comment #7
sgabe CreditAttribution: sgabe commentedOkay, I found the problem. Actually the submit callback never runs for registered users on unsubscription. Please test the attached patch.
Comment #8
gaele CreditAttribution: gaele commentedThe first bug is solved. The second still exists.
In simplenews_realname_mail_alter():
$recipient should be a string. Perhaps you where thinking of "User <user@example.com>"?
Comment #9
sgabe CreditAttribution: sgabe commentedWhat Mime Mail version and mail engine are you using?
Comment #10
gaele CreditAttribution: gaele commentedsendmail
But this looks like a PHP limitation. mail.inc calls PHP mail. http://php.net/manual/en/function.mail.php:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
Comment #11
sgabe CreditAttribution: sgabe commentedI mean what mail engine for Mime Mail? Default, SMTP, PHPMailer etc? Mime Mail accepts array for the recipient and converts it to string.
Comment #12
gaele CreditAttribution: gaele commentedAh I see. mimemail 6.x-1.0-alpha6 with default engine ('mimemail').
Comment #13
gaele CreditAttribution: gaele commentedThe subscription mail sent by simplenews is just plain text, though. Mimemail isn't used.
Comment #14
gaele CreditAttribution: gaele commentedThis is working for me (taken from mimemail_address()):
Comment #15
sgabe CreditAttribution: sgabe commentedNote that Windows based systems will reject formatted addresses, we need to check that first.
Comment #16
sgabe CreditAttribution: sgabe commentedComment #17
sgabe CreditAttribution: sgabe commentedCommitted to both branches. I hope all of this is fixed now. Thanks!
Comment #18
gaele CreditAttribution: gaele commentedThank you sgabe!