You are here

function vote_storylink_feed_user in Vote Up/Down 5

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

File

./vote_storylink.module, line 509

Code

function vote_storylink_feed_user($uid = 0) {
  global $user;
  if ($uid) {
    $account = user_load(array(
      'uid' => $uid,
      'status' => 1,
    ));
  }
  else {
    $account = $user;
  }
  $sql = db_rewrite_sql("SELECT n.nid, n.title, n.created, r.teaser, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'storylink' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC");
  $result = db_query_range($sql, $uid, 0, variable_get('feed_default_items', 10));
  $channel['title'] = $account->name . "'s story links";
  $channel['link'] = url("storylink/{$uid}", NULL, NULL, TRUE);
  $channel['description'] = t('User storylinks');
  node_feed($result, $channel);
}