You are here

function mass_contact_cron in Mass Contact 7

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

Implements hook_cron_queue_info().

File

./mass_contact.module, line 385
This is the main code file for the Mass Contact module.

Code

function mass_contact_cron() {

  // Get the Mass Contact queue, if there is one.
  $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 is sent, delete it.
    $queue
      ->deleteItem($message);
  }
}