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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zealfire’s picture

Assigned: Unassigned » zealfire

I also think that this is a bug so attaching a patch below.

zealfire’s picture

I am including a patch which worked for me, hope it works for you.
Thanks

zealfire’s picture

Status: Active » Needs review
abarpetia’s picture

Thank 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!

zealfire’s picture

@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.

abarpetia’s picture

@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).

jcnventura’s picture

Status: Needs review » Needs work

Renaming 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.

abarpetia’s picture

@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.

abarpetia’s picture

Status: Needs work » Needs review
abarpetia’s picture

Hello,
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

jcnventura’s picture

Status: Needs review » Reviewed & tested by the community
sriharsha.uppuluri’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Patch is not applying

visabhishek’s picture

Version: 7.x-2.0 » 7.x-2.x-dev

Changing to latest Dev branch

visabhishek’s picture

Re-rolled patch

visabhishek’s picture

Status: Needs work » Needs review

Changing status to Needs Review

jcnventura’s picture

Status: Needs review » Reviewed & tested by the community
abarpetia’s picture

Patch provided in #14 smoothly worked for me. Thank you.

abarpetia’s picture

Bump. Just wondering, is it possible to get this patch applied to dev branch?

  • jcnventura committed bdad10a on 7.x-2.x authored by visabhishek
    Issue #2427639 by abarpetia, zealfire, visabhishek: User list in send by...
jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Yes.

abarpetia’s picture

Thanks for committing this patch. :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.