No matter what value i set the feeds "Promoted items" to be, only the latest 3 appear when viewing the feed node.

Comments

budda’s picture

Assigned: Unassigned » budda
Status: Active » Needs review

Okay, the bug was in the feedapi_item.module -- the value '3' was hardcoded in the for loop. here's the corrected feedapi_item_nodeapi() function, also corrected the comment for the function ;-)

I replaced the hardcoded '3' with a reference to the settings value in the $feed object, $feed->settings['processors']['feedapi_item']['promote'] -- is this always valid on the $feed object?

/**
 * Implementation of hook_nodeapi().
 */
function feedapi_item_nodeapi(&$node, $op, $teaser, $page) {
  switch ($op) {
  case 'delete':
    $result = db_query("SELECT fiid FROM {feedapi_node_item} WHERE nid = %d", $node->nid);
    if (db_num_rows($result) > 0) {
      $feed_item = db_fetch_object($result);
      feedapi_item_feedapi_item_delete($feed_item);
    }
    break;
  }
  if ($op == 'view' && !$teaser && isset($node->feed->nid)) {
    $feed = $node->feed;
    if (is_array($feed->processors)) {
      if (in_array('feedapi_item', call_user_func_array('array_merge', $feed->processors))) {
        $items = module_invoke('feedapi_item', 'feedapi_item_fetch_items', $feed);
        for ($i = 0; $i != $feed->settings['processors']['feedapi_item']['promote'] && $i != count($items); $i++) {
          $list[] = l($items[$i]->title, 'node/'. $items[$i]->nid);
        }
        $node->content['body']['#value'] .= theme('item_list', $list);
      }
    }
  }
}
aron novak’s picture

Promoted items is about a different thing: The newest N items will be promoted on the front page per feed .
So it's about putting the news items to the front page of the Drupal site.
But I can say too that this behaviour is really a bug, I'll find out how and where possible to adjust this hardcoded value.

aron novak’s picture

Status: Needs review » Fixed

There is a new option for feedapi_item processor: "Number of listed news items at feed node:" Here you can adjust the listed items. (instead of the ugly hardcoded value)

aron novak’s picture

Status: Fixed » Closed (fixed)