Hi,

I've started experimenting with this module to send an email to all authenticated users, but it only seem to sent to users whose accounts are enabled.
This is probably by design, but in my case I've many (imported) users who are disabled and I'd to inform then of events.

browding though the code the following seems like it might be the place that limits emails to active users:
mass_contact.module, line 1303

$recipients = db_query("SELECT name, mail, uid FROM {users} WHERE status <> %d AND uid > %d", 0, 0);

Is that the right place to remove the status check?
Is there an alternative way to do this without hacking module, perhaps there is a relevant feature in the new dev release?

Thanks in advance,

Sean

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oadaeh’s picture

Based on the line number you mentioned, it seems to me the version you are using is not the same one you have selected in this issue. You might want to double check which version you are using.

As a disclaimer, I did not test the changes I mention below. They should work fine, but there may be an error in what I pasted, so you should test them before you make them live.

There are four lines you would need to change:

At about line 1278, from:

  $ooresult = db_query("SELECT uid FROM {users} WHERE status <> %d", 0);

to:

  $ooresult = db_query("SELECT uid FROM {users}");

At about line 1280, from:

  $account = user_load(array('uid' => $oouid->uid, 'status' => 1));

to:

  $account = user_load(array('uid' => $oouid->uid));

At about line 1296, from:

  $recipients = db_query("SELECT name, mail, uid FROM {users} WHERE status <> %d AND uid > %d", 0, 0);

to:

  $recipients = db_query("SELECT name, mail, uid FROM {users} WHERE uid > %d", 0);

At about line 1309, from:

  $uids = db_query("SELECT ur.uid FROM {users_roles} ur LEFT JOIN {users} u ON ur.uid = u.uid WHERE ur.rid = %d AND u.status <> %d", $r, 0);

to:

  $uids = db_query("SELECT ur.uid FROM {users_roles} ur LEFT JOIN {users} u ON ur.uid = u.uid WHERE ur.rid = %d", $r);
boran’s picture

Title: Send email to authenticated user even if their account is blocked » Send email to authenticated user even if their account is disables

Thanks, the line number was wrng in my initial post. You suggestions make sense and do not cause any errors, I'll now do some testing .
Thanks.

oadaeh’s picture

Title: Send email to authenticated user even if their account is disables » Send email to authenticated user even if their account is blocked

Tweaking the title.

oadaeh’s picture

Title: Send email to authenticated user even if their account is disables » Send email to authenticated user even if their account is blocked
Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Category: support » feature
oadaeh’s picture

Marked #937400: Sending e-mail to inactive users. as a duplicate of this.

oadaeh’s picture

Marked #912756: Mass contact blocked as a duplicate of this (back on September 15, 2010).

oadaeh’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Component: Code » Categories

Thanks to ygerasimov, the 7.x-1.x version of Mass Contact now utilizes the Chaos tools suite (ctools) plugin system. I will reexamine this and realted issues with that plugin system in mind to determine whether to create a plugin for this request or not.

SV’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
4.89 KB

Following patch provides "User status" options on the category page. So, administrator will be able to create a category and sent email to every users (blocked or active).

Status: Needs review » Needs work

The last submitted patch, 8: 787168-8.patch, failed testing. View results

SV’s picture

Status: Needs work » Needs review
robertragas’s picture

Status: Needs review » Needs work

Patch not working like expected. The options for user_status are not saving correctly.

robertragas’s picture

FileSize
5.62 KB

Added a patch where I changed it and should work now, but think the code still could use optimization.

robertragas’s picture

FileSize
6.18 KB