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 wonderful module.
I am using this module to allow my customers to send email to site users and after enabling "Enable user list recipients" option in email setting page it shows list of all site users but it also show blocked users. I think this list should be filtered based on the user account status.
I am not sure whether this is a bug or feature request but according to me it is bug. So, is there any way to solve this?
Comments
Comment #1
zealfire CreditAttribution: zealfire commentedI also think that this is a bug so attaching a patch below.
Comment #2
zealfire CreditAttribution: zealfire commentedI am including a patch which worked for me, hope it works for you.
Thanks
Comment #3
zealfire CreditAttribution: zealfire commentedComment #4
abarpetia CreditAttribution: abarpetia commentedThank you zealfire, the patch in #2 worked in my development environment but it throwing exception in my production environment.
Here is the Error message:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'r.status' in 'field list': SELECT u.mail, r.realname, r.status AS name from {users} u LEFT JOIN {realname} r ON u.uid = r.uid WHERE u.uid <> :uid ORDER BY name ASC; Array ( [:uid] => 0 ) in print_mail_form_for_path() (line 99 of /sites/all/modules/print/print_mail/print_mail.inc).
Cheers!
Comment #5
zealfire CreditAttribution: zealfire commented@abarpetia thanks for pointing this out now I realised the importance of the line where it says:module_exists('realname').Basically over here it is checking for realname module but since I assume you don't have that module installed therefore else part of condition executed where it is able to retrieve status field hence you got the patch working but error still remains.
I recommend that if you install realname module in future then replace r.status to u.status and then it would work.
I will soon be making a patch for this.Hope this helps.
Comment #6
abarpetia CreditAttribution: abarpetia commented@zealfire: Thanks for explaining. My production environment has realname module installed and when i changed r.status to u.status it showing me following notice messages:
Notice: Undefined property: stdClass::$uid in print_mail_form_for_path() (line 97 of sites\all\modules\print\print_mail\print_mail.inc).
Notice: Undefined property: stdClass::$uid in print_mail_form_for_path() (line 97 of sites\all\modules\print\print_mail\print_mail.inc).
on this line in print_mail.inc: if ($recipient->status) {
and also my send to user list is not showing any users (empty).
Comment #7
jcnventura CreditAttribution: jcnventura commentedRenaming to u.status will not fix it, as u.status is then returned "AS name". Also why return the status at all?
The proper fix is to add status = 1 to the WHERE part of those SELECTS.
Comment #8
abarpetia CreditAttribution: abarpetia commented@jcnventura: I tested your suggestion and it work perfectly with/without enabling realname module. I have also created patch so may i please ask you to review it.
Comment #9
abarpetia CreditAttribution: abarpetia commentedComment #10
abarpetia CreditAttribution: abarpetia commentedHello,
Sorry to rush back, is there any updates on given patch? are there are any possibilities to push this solution to this module?
Thank You,
Aniket
Comment #11
jcnventura CreditAttribution: jcnventura commentedComment #12
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri at Azri Solutions commentedPatch is not applying
Comment #13
visabhishek CreditAttribution: visabhishek as a volunteer and at Azri Solutions commentedChanging to latest Dev branch
Comment #14
visabhishek CreditAttribution: visabhishek as a volunteer and at Azri Solutions commentedRe-rolled patch
Comment #15
visabhishek CreditAttribution: visabhishek as a volunteer and at Azri Solutions commentedChanging status to Needs Review
Comment #16
jcnventura CreditAttribution: jcnventura commentedComment #17
abarpetia CreditAttribution: abarpetia commentedPatch provided in #14 smoothly worked for me. Thank you.
Comment #18
abarpetia CreditAttribution: abarpetia commentedBump. Just wondering, is it possible to get this patch applied to dev branch?
Comment #20
jcnventura CreditAttribution: jcnventura commentedYes.
Comment #21
abarpetia CreditAttribution: abarpetia commentedThanks for committing this patch. :)