function invite_cron in Invite 7.4
Same name and namespace in other branches
- 5 invite.module \invite_cron()
Implements hook_cron().
Updates status of invites to INVITE_EXPIRED if expiry time has past.
File
- ./
invite.module, line 893
Code
function invite_cron() {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'invite')
->propertyCondition('expiry', time(), "<")
->propertyCondition('status', INVITE_VALID, "=");
$results = $query
->execute();
if (!empty($results) && !empty($results['invite'])) {
$invites = entity_load('invite', array_keys($results['invite']));
foreach ($invites as $invite) {
$invite->status = INVITE_EXPIRED;
entity_save('invite', $invite);
}
}
}