• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  RSS Feed Error

jadmperry

Well-known member
#1
I have just started to try to use feeds. I have set three different feeds and they throw up errors and I don't get a feed show up in the destination forum.

Here is the error:

  1. XenForo_Application::handlePhpError()inXenForo/Model/Feed.phpat line317
  2. XenForo_Model_Feed->_getAuthorNamesFromArray()inXenForo/Model/Feed.phpat line254
  3. XenForo_Model_Feed->prepareFeedEntry()inXenForo/Model/Feed.phpat line235
  4. XenForo_Model_Feed->prepareFeedData()inXenForo/Model/Feed.phpat line494
  5. XenForo_Model_Feed->importFeedData()inXenForo/ControllerAdmin/Feed.phpat line163
  6. XenForo_ControllerAdmin_Feed->actionImport()inXenForo/FrontController.phpat line310
  7. XenForo_FrontController->dispatch()inXenForo/FrontController.phpat line132
  8. XenForo_FrontController->run()in/home/content/32/6838832/html/Xenforo/admin.phpat line13
Ideas?
 

jadmperry

Well-known member
#2
Wait a minute...It may be the feeds themselves. I was importing from a government website for all three feeds, I just added a new feed from another site, worked a charm.
 

Mike

XenForo developer
Staff member
#4
Unfortunately, that's skipped the actual error - it comes before the backtrace that you've included. Also, we need to know the feed.
 

jadmperry

Well-known member
#5
Mike,

Thanks for taking a look. Here is the error message:

Server Error

Undefined index: name
  1. XenForo_Application::handlePhpError()inXenForo/Model/Feed.phpat line317
  2. XenForo_Model_Feed->_getAuthorNamesFromArray()inXenForo/Model/Feed.phpat line254
  3. XenForo_Model_Feed->prepareFeedEntry()inXenForo/Model/Feed.phpat line235
  4. XenForo_Model_Feed->prepareFeedData()inXenForo/Model/Feed.phpat line494
  5. XenForo_Model_Feed->importFeedData()inXenForo/ControllerAdmin/Feed.phpat line163
  6. XenForo_ControllerAdmin_Feed->actionImport()inXenForo/FrontController.phpat line310
  7. XenForo_FrontController->dispatch()inXenForo/FrontController.phpat line132
  8. XenForo_FrontController->run()in/home/content/32/6838832/html/Xenforo/admin.phpat line13
Here is the feed: http://www.gibill.va.gov/rss/feeds/general.xml

 

Kier

XenForo Developer
Staff member
#6
I've fixed this now.

The error was that the feed does not expose author name, only author email. I have adjusted XenForo_Model_Feed::_getAuthorNamesFromArray() accordingly to use name first, email alternatively or else to not populate the data.
 

Kier

XenForo Developer
Staff member
#7
PHP:
	/**

	 * Attempts to convert a Zend_Feed_Reader_Collection_Author object
	 * into a comma-separated list of names.
	 *
	 * @param Zend_Feed_Reader_Collection_Author|null $feedAuthors
	 *
	 * @return string
	 */
	protected function _getAuthorNamesFromArray($feedAuthors)
	{
		$authorNames = array();

		if ($feedAuthors)
		{
			foreach ($feedAuthors AS $author)
			{
				if (isset($author['name']))
				{
					$authorNames[] = $author['name'];
				}
				else if (isset($author['email']))
				{
					$authorNames[] = $author['email'];
				}
			}
		}

		return implode(', ', $authorNames);
	}