7

I am using Drupal 7, and I want to send email to registered users who have not logged in to the site since 30 days; for example, an email saying:

Hello user, you are not login since 30 days.

Is there any way?

8

You can use the Rules module to do this.

Make a rule that that is triggered when a user logs in. Make this rule schedule sending this e-mail in 30 days. Let the identifier of the task be something like 30-days reminder for [account:uid]. This way, if the user logs in within the next 30 days, the scheduled task will be overwritten - pushing the 30 days e-mail.

Make sure to activate the Rules Scheduler module.

1

Take a look at the User Stats module, it might be something that could work for you. From the module's project page:

Provides commonly requested user statistics for themers, IP address tracking and Views integration. Statistics are:

  • Days registered
  • Join date Days since last login
  • Days since last post

etc and then, you can use cronjob to send email.

0

Another way would be to implement hook_cron. like this:

function yourmodulename_cron() {
  $users = database query to get users that have not logged on in the last 30 days
  $queue = DrupalQueue::get('send_maillast30days');
  foreach ($users as $user) {
    $queue->createItem($user);
  }
}

Also you will have to implement a queue using hook_cron_queue_info as shown here:

function yourmodulename_cron_queue_info() {
  $queues['send_maillast30days'] = array(
    'worker callback' => 'yourmodulename_send_email30days',
    'time' => 60,
  );
  return $queues;
}

you will also have to implement "yourmodulename_send_email30days" function: i.e

function yourmodulename_send_email30days($user) {
  //use drupal_mail function to send the mail (see http://api.drupal.org/api/drupal/includes%21mail.inc/function/drupal_mail/7)
}
0

You can try the Inactive user module:

Inactive user
http://drupal.org/project/inactive_user

The inactive_user module provides Drupal administrators with a way to automatically manage inactive user accounts. This module has two goals: to help keep users coming back to your site by reminding them when they've been away for a configurable period of time, and to cleanup unused accounts.

  • Inactive_user has 0 documentation, and does nothing. – sea26.2 Dec 11 '13 at 0:22
  • inactive_user is unmaintained and has some serious bugs (like sending notifications to blocked users) – rfay Oct 16 '15 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.