You are here

function simplenews_roles_cron in Simplenews Roles 7

Same name and namespace in other branches
  1. 5 simplenews_roles.module \simplenews_roles_cron()
  2. 6.2 simplenews_roles.module \simplenews_roles_cron()
  3. 6 simplenews_roles.module \simplenews_roles_cron()

Implements hook_cron().

1 call to simplenews_roles_cron()
SimplenewsRolesResyncTestCase::testRegular in tests/simplenews_roles.test

File

./simplenews_roles.module, line 224
Synchronize user subscriptions based on user roles membership.

Code

function simplenews_roles_cron() {

  // Check if we need to resync anything.
  $resync = variable_get('simpelnews_roles_resync', array());
  if (!empty($resync)) {
    $tid = key($resync);
    $sync_done = simplenews_roles_update_subscriptions($tid, $resync[$tid]);
    if ($sync_done) {
      unset($resync[$tid]);
      variable_set('simpelnews_roles_resync', $resync);
    }
  }
}