You are here

function vote_storylink_feed_interval_top in Vote Up/Down 5

1 call to vote_storylink_feed_interval_top()
vote_storylink_page in ./vote_storylink.module
Menu callback; displays a Drupal page containing recent story links entries.

File

./vote_storylink.module, line 499

Code

function vote_storylink_feed_interval_top($interval) {
  $epoch = strtotime("-1 {$interval}");
  $sql = db_rewrite_sql("SELECT n.nid, n.created, n.title, r.teaser, v.content_id, v.value, v.tag, v.function FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {votingapi_cache} v ON n.nid = v.content_id WHERE n.type = 'storylink' AND n.status = 1 AND n.created >= %d AND v.tag = 'vote' AND v.function = 'sum' AND v.content_type = 'node' ORDER BY v.value DESC, n.created DESC");
  $result = db_query_range($sql, $epoch, 0, variable_get('feed_default_items', 10));
  $channel['title'] = variable_get('site_name', 'drupal') . ' popular story links this ' . $interval;
  $channel['link'] = url("storylink/top/{$interval}", NULL, NULL, TRUE);
  $channel['description'] = t('Popular storylinks');
  node_feed($result, $channel);
}