You are here

function user_external_invite_cron in User External Invite 7

Same name and namespace in other branches
  1. 7.2 user_external_invite.module \user_external_invite_cron()
  2. 1.0.x user_external_invite.module \user_external_invite_cron()

Implements hook_cron().

Set invites to expired status if too much time has passed.

File

./user_external_invite.module, line 771
Invites a user to site when connecting via external protocol e.g. LDAP.

Code

function user_external_invite_cron() {

  // Set status of expired invites.
  db_update('user_external_invite')
    ->fields(array(
    'status' => 'Expired',
  ))
    ->condition('expire', REQUEST_TIME, '<')
    ->execute();

  // Delete old invites after 30 days.
  $expire_time = variable_get('user_external_invite_delete_old_invites', 60 * 60 * 24 * 30);
  db_delete('user_external_invite')
    ->condition('expire', REQUEST_TIME - $expire_time, '<')
    ->execute();
}