You are here

function _quotes_feed_user in Quotes 6

Same name and namespace in other branches
  1. 5 quotes.module \_quotes_feed_user()
  2. 7 quotes.module \_quotes_feed_user()

Displays an RSS feed containing recent quotes of a given user.

Parameters

$uid: The user ID of the user's quotes to be fed.

1 call to _quotes_feed_user()
quotes_page in ./quotes.module
Menu callback that calls theme_quotes_page().

File

./quotes.module, line 1561
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

Code

function _quotes_feed_user($uid) {
  global $user;
  $luser = $uid ? user_load(array(
    'uid' => $uid,
    'status' => 1,
  )) : $user;
  $result = db_query_range(db_rewrite_sql("SELECT n.nid, nr.title, nr.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} nr ON nr.vid = n.vid INNER JOIN {users} u ON u.uid = n.uid WHERE n.status = 1 AND n.type = 'quotes' AND u.uid = %d ORDER BY n.created DESC"), $luser->uid, 0, 15);
  $nids = array();
  while ($row = db_fetch_object($result)) {
    $nids[] = $row->nid;
  }
  node_feed($nids, array(
    'title' => t("!name's quotes", array(
      '!name' => $luser->uid ? $luser->name : variable_get('anonymous', t('Anonymous')),
    )),
    'link' => url("quotes/{$luser->uid}", array(
      'absolute' => TRUE,
    )),
  ));
}