function simplenews_statistics_count_unsubscribes in Simplenews Statistics 7
Same name and namespace in other branches
- 7.2 simplenews_statistics.module \simplenews_statistics_count_unsubscribes()
Counts the number of unsubscribes for a newsletter category.
1 call to simplenews_statistics_count_unsubscribes()
- simplenews_statistics_handler_unsubscribes::render in includes/
views/ handlers/ simplenews_statistics_handler_unsubscribes.inc - Renders the field handler.
File
- ./
simplenews_statistics.module, line 451 - Main simplenews statistics file.
Code
function simplenews_statistics_count_unsubscribes($tid, $start = 0, $end = REQUEST_TIME, $source = '') {
$query = db_select('simplenews_subscription', 'ss')
->condition('ss.tid', $tid)
->condition('ss.timestamp', $start, '>')
->condition('ss.timestamp', $end, '<')
->condition('ss.status', 0);
if ($source != '') {
$query
->condition('ss.source', $source);
}
return $query
->countQuery()
->execute()
->fetchField();
}