XF 1.5 RSS feed URL for threads with a prefix

vmgkartik

Member
Hi

I want to get the RSS feed URL to only fetch threads from my forum which start with a certain prefix.

Is this possible? If yes, how to write the RSS feed URL structure.

Thanks,
 

Jake Bunce

XenForo moderator
Staff member
Ideally you should make this an addon, but here is a file edit:

library/XenForo/ControllerPublic/Forum.php

Add the red code:

Rich (BB code):
	/**
	 * Gets the data for the global forum RSS feed.
	 *
	 * @return XenForo_ControllerResponse_Abstract
	 */
	public function getGlobalForumRss()
	{
		$threadModel = $this->_getThreadModel();
		$visitor = XenForo_Visitor::getInstance();
		
		$prefix = $this->_input->filterSingle('prefix', XenForo_Input::STRING);

		$threadsPerPage = max(1, XenForo_Application::get('options')->discussionsPerPage);
		$autoReadDate = XenForo_Application::$time - (XenForo_Application::get('options')->readMarkingDataLifetime * 86400);

		$threads = $threadModel->getThreads(
			array(
				'find_new' => true,
				'last_post_date' => array('>', $autoReadDate),
				'not_discussion_type' => 'redirect',
				'title' => ($prefix ? array($prefix, 'r') : '')
			),
			array(
				'limit' => $threadsPerPage * 3, // to filter
				'order' => 'last_post_date',
				'join' =>
					XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_FORUM_OPTIONS |
					XenForo_Model_Thread::FETCH_USER | XenForo_Model_Thread::FETCH_FIRSTPOST,
				'permissionCombinationId' => $visitor['permission_combination_id']
			)
		);
The URL is like this:

/index.php?forums/-/index.rss&prefix=asdf

Or this with friendly URLs:

/forums/-/index.rss?prefix=asdf
 
Top