function subscriptions_testpost in Subscriptions 5
Test to see if a post is still active before notifications are sent
1 call to subscriptions_testpost()
- subscriptions_cron in ./
subscriptions.module - Implementation of cron job.
2 string references to 'subscriptions_testpost'
- subscriptions_cron in ./
subscriptions.module - Implementation of cron job.
- subscriptions_settings in ./
subscriptions.module - Admin settings
File
- ./
subscriptions.module, line 686
Code
function subscriptions_testpost($content, $ptype) {
$content = unserialize($content);
$valid = FALSE;
switch ($ptype) {
case 'comment':
// comment handling
$cid = is_null($content->cid) ? $content['cid'] : $content->cid;
$result = db_query('SELECT pid, status FROM {comments} WHERE cid = %d', $cid);
$row = db_fetch_object($result);
if (!is_null($row->pid) && $row->pid != 0 && $row->status != 1) {
$valid = TRUE;
}
break;
case 'node':
// node handling
$nid = is_null($content->nid) ? $content['nid'] : $content->nid;
$result = db_query('SELECT status FROM {node} WHERE nid = %d', $nid);
if (db_result($result) == 1) {
$valid = TRUE;
}
break;
}
return $valid;
}