function simplenews_recent_newsletters in Simplenews 5
Same name and namespace in other branches
- 6.2 simplenews.module \simplenews_recent_newsletters()
- 6 simplenews.module \simplenews_recent_newsletters()
- 7.2 simplenews.module \simplenews_recent_newsletters()
- 7 simplenews.module \simplenews_recent_newsletters()
1 call to simplenews_recent_newsletters()
- _simplenews_block in ./
simplenews.module - Helper function: generate block content before theming Collects data and applies access restriction
File
- ./
simplenews.module, line 1063
Code
function simplenews_recent_newsletters($tid, $count = 5, $title = NULL) {
$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.title, sn.s_status FROM {node} n INNER JOIN {term_node} t ON n.nid = t.nid INNER JOIN {simplenews_newsletters} sn ON n.nid = sn.nid WHERE (t.tid = %d AND n.status = 1) ORDER BY n.created DESC'), $tid, 0, $count);
$titles = array();
while ($item = db_fetch_object($result)) {
$titles[$item->nid]['data'] = l($item->title, 'node/' . $item->nid);
$titles[$item->nid]['class'] = $item->s_status == 0 ? 'newsletter-created' : 'newsletter-send';
}
return $titles;
}