You are here

function mass_contact_cron in Mass Contact 6

Same name and namespace in other branches
  1. 7 mass_contact.module \mass_contact_cron()

Implements hook_cron_queue_info().

File

./mass_contact.module, line 313
This is the main code file for the Mass Contact module. This module enables users to contact multiple users through selected roles.

Code

function mass_contact_cron() {
  if (module_exists('drupal_queue')) {

    // Get the queue.
    $queue = DrupalQueue::get('mass_contact');

    // Get the next item in the queue.
    $message = $queue
      ->claimItem();

    // If there are no items, nothing will happen.
    if (!empty($message)) {

      // Send the current message item.
      _mass_contact_prepare_message_for_sending($message);

      // Now that it's sent, delete it.
      $queue
        ->deleteItem($message);
    }
  }
}