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

Is it possible to limit to the new threads the global RSS feed?

Discussion in 'XenForo Questions and Support' started by giorgino, Jun 17, 2012.

  1. giorgino

    giorgino Well-Known Member

    I use the feed for Google, Twitter, Facebook and Google+ pages, but the global feed include all the "discussed" threads and not the new threads only.

    Is it possible to limit to the new threads the global RSS feed?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I think you want this:

    library/XenForo/ControllerPublic/Forum.php

    Remove the red code:

    Code:
    	public function getGlobalForumRss()
    	{
    		$threadModel = $this->_getThreadModel();
    		$visitor = XenForo_Visitor::getInstance();
    
    		$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)),
    			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,
    				'permissionCombinationId' => $visitor['permission_combination_id']
    			)
    		);
    		foreach ($threads AS $key => $thread)
    		{
    			$thread['permissions'] = XenForo_Permission::unserializePermissions($thread['node_permission_cache']);
    
    			if (!$threadModel->canViewThreadAndContainer($thread, $thread, $null, $thread['permissions']))
    			{
    				unset($threads[$key]);
    			}
    		}
    		$threads = array_slice($threads, 0, $threadsPerPage, true);
    
    		$viewParams = array(
    			'threads' => $threads
    		);
    		return $this->responseView('XenForo_ViewPublic_Forum_GlobalRss', '', $viewParams);
    	}
    
    Now the global feed will order threads by thread start date, not last post date.
     
    giorgino likes this.
  3. giorgino

    giorgino Well-Known Member

    Thank you Jacke, as always you know the answer! :love:
    I'll test this and report back for future readers (y)
     
  4. giorgino

    giorgino Well-Known Member

    One more thing Jake. Do I need to run a cron or something else for refresh the RSS Feed cache (if exists)?
    Thank you
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Nope. It's not cached.
     
  6. giorgino

    giorgino Well-Known Member

    Thanks!
    It's timed? :cautious:
     
  7. Ivar

    Ivar Member

    @giorgino did you figure this out? I have made the edit above, but it did not make a difference. This post was from 2012 so things might have changed as well. Any idea @Jake Bunce ?

    [edit My mistake... forgot I had cache on my server . After refresh works!]
     
  8. akia

    akia Well-Known Member

    Is this still working with the latest version?
     
  9. tr1age

    tr1age Active Member

    Weird question with Xenforo 1.5 is there a way to get it so it DOES what it used to do with the posts in global RSS reposting every time there is a new reply?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That is what it currently does in XF 1.5
     

Share This Page