Pull Latest Threads

It's all definitely possible - in fact, relatively easy, except no one has submitted the mod yet. I don't think you can do it with URL forms as mentioned because that would (in theory) open up the system for a lot of hacking.

But easytarget has a widget that does this for wordpress..
http://xenforo.com/community/resources/wordpress-get-the-lastest-forum-posts.162/

You can include and exclude forums.

He may be able to provide a mod to make it work in XF or in any php page. I want something like this myself to run in a php page outside of XF, but have been unable to find it. Still, I know it can be done since one member quoted me a price on a custom mod for it.
 
Maybe you and the OP can split the cost :)

I might consider that - but it seems like so "stock" of a function that I am hesitant to pay for it. Heck, my 2003 vintage forum sw did it with a simple call of a template using php include.

I don't mind paying for things - but this one sure seems like either a core feature or "donate ware".
 
I like that feature in vB.

The search system has parameters for all of this. For example:

http://xenforo.com/community/search..._discussion=1&order=date&nodes[]=5&nodes[]=45

The problem is you have to specify a keyword or member name to search by. You can remove this requirement by editing this file:

library/XenForo/ControllerPublic/Search.php

Add the red code:

Rich (BB code):
	public function actionSearch()
	{
		// note: intentionally not post-only

		if (!XenForo_Visitor::getInstance()->canSearch())
		{
			throw $this->getNoPermissionResponseException();
		}

		$input = $this->_input->filter(array(
			'keywords' => XenForo_Input::STRING,
			'title_only' => XenForo_Input::UINT,
			'date' => XenForo_Input::DATE_TIME,
			'users' => XenForo_Input::STRING,
			'nodes' => array(XenForo_Input::UINT, 'array' => true),
			'child_nodes' => XenForo_Input::UINT,
			'user_content' => XenForo_Input::STRING,

			'order' => XenForo_Input::STRING,
			'group_discussion' => XenForo_Input::UINT
		));
		$input['type'] = $this->_handleInputType($input);

		if (!$input['order'])
		{
			$input['order'] = 'date';
		}

		$origKeywords = $input['keywords'];
		$input['keywords'] = XenForo_Helper_String::censorString($input['keywords'], null, ''); // don't allow searching of censored stuff

		$visitorUserId = XenForo_Visitor::getUserId();
		$searchModel = $this->_getSearchModel();

		$constraints = $searchModel->getGeneralConstraintsFromInput($input, $errors);
		if ($errors)
		{
			return $this->responseError($errors);
		}

		if (!$input['type'] && $input['keywords'] === ''
			&& count($constraints) == 1
			&& !empty($constraints['user']) && count($constraints['user']) == 1
		)
		{
			// we're searching for messages by a single user
			$this->_request->setParam('user_id', reset($constraints['user']));
			return $this->responseReroute(__CLASS__, 'member');
		}
/*
		if ($input['keywords'] === '' && empty($constraints['user']))
		{
			// must have keyword or user constraint
			return $this->responseError(new XenForo_Phrase('please_specify_search_query_or_name_of_member'));
		}
*/
		$typeHandler = null;
		if ($input['type'])
		{
			if (is_array($input['type']))
			{
				$typeInfo = $input['type'];
				list($input['type'], $contentInfo) = each($input['type']);
				list($contentType, $contentId) = each($contentInfo);
			}

			$typeHandler = $searchModel->getSearchDataHandler($input['type']);
			if ($typeHandler)
			{
				$constraints = array_merge($constraints,
					$typeHandler->getTypeConstraintsFromInput($this->_input)
				);
			}
		}

		$search = $searchModel->getExistingSearch(
			$input['type'], $input['keywords'], $constraints, $input['order'], $input['group_discussion'], $visitorUserId
		);

		if (!$search)
		{
			$searcher = new XenForo_Search_Searcher($searchModel);

			if ($typeHandler)
			{
				$results = $searcher->searchType(
					$typeHandler, $input['keywords'], $constraints, $input['order'], $input['group_discussion']
				);

				$userResults = array();
			}
			else
			{
				$results = $searcher->searchGeneral($input['keywords'], $constraints, $input['order']);

				$userResults = $this->_getUserSearch($input['keywords']);
			}

			if (!$results && !$userResults)
			{
				return $this->getNoSearchResultsResponse($searcher);
			}

			$warnings = $searcher->getErrors() + $searcher->getWarnings();

			$search = $searchModel->insertSearch(
				$results, $input['type'], $origKeywords, $constraints, $input['order'], $input['group_discussion'], $userResults,
				$warnings, $visitorUserId
			);
		}

		return $this->responseRedirect(
			XenForo_ControllerResponse_Redirect::SUCCESS,
			XenForo_Link::buildPublicLink('search', $search),
			''
		);
	}

Now the above link will work.

The presentation is different (shown as search results) because it's using the search system instead of what's new. But it's an easy hack since the search system already has the needed criteria.
 
I like that feature in vB.

The search system has parameters for all of this. For example:

http://xenforo.com/community/search..._discussion=1&order=date&nodes[]=5&nodes[]=45

The problem is you have to specify a keyword or member name to search by. You can remove this requirement by editing this file:

library/XenForo/ControllerPublic/Search.php

Add the red code:

Rich (BB code):
public function actionSearch()
{
// note: intentionally not post-only
 
if (!XenForo_Visitor::getInstance()->canSearch())
{
throw $this->getNoPermissionResponseException();
}
 
$input = $this->_input->filter(array(
'keywords' => XenForo_Input::STRING,
'title_only' => XenForo_Input::UINT,
'date' => XenForo_Input::DATE_TIME,
'users' => XenForo_Input::STRING,
'nodes' => array(XenForo_Input::UINT, 'array' => true),
'child_nodes' => XenForo_Input::UINT,
'user_content' => XenForo_Input::STRING,
 
'order' => XenForo_Input::STRING,
'group_discussion' => XenForo_Input::UINT
));
$input['type'] = $this->_handleInputType($input);
 
if (!$input['order'])
{
$input['order'] = 'date';
}
 
$origKeywords = $input['keywords'];
$input['keywords'] = XenForo_Helper_String::censorString($input['keywords'], null, ''); // don't allow searching of censored stuff
 
$visitorUserId = XenForo_Visitor::getUserId();
$searchModel = $this->_getSearchModel();
 
$constraints = $searchModel->getGeneralConstraintsFromInput($input, $errors);
if ($errors)
{
return $this->responseError($errors);
}
 
if (!$input['type'] && $input['keywords'] === ''
&& count($constraints) == 1
&& !empty($constraints['user']) && count($constraints['user']) == 1
)
{
// we're searching for messages by a single user
$this->_request->setParam('user_id', reset($constraints['user']));
return $this->responseReroute(__CLASS__, 'member');
}
/*
if ($input['keywords'] === '' && empty($constraints['user']))
{
// must have keyword or user constraint
return $this->responseError(new XenForo_Phrase('please_specify_search_query_or_name_of_member'));
}
*/
$typeHandler = null;
if ($input['type'])
{
if (is_array($input['type']))
{
$typeInfo = $input['type'];
list($input['type'], $contentInfo) = each($input['type']);
list($contentType, $contentId) = each($contentInfo);
}
 
$typeHandler = $searchModel->getSearchDataHandler($input['type']);
if ($typeHandler)
{
$constraints = array_merge($constraints,
$typeHandler->getTypeConstraintsFromInput($this->_input)
);
}
}
 
$search = $searchModel->getExistingSearch(
$input['type'], $input['keywords'], $constraints, $input['order'], $input['group_discussion'], $visitorUserId
);
 
if (!$search)
{
$searcher = new XenForo_Search_Searcher($searchModel);
 
if ($typeHandler)
{
$results = $searcher->searchType(
$typeHandler, $input['keywords'], $constraints, $input['order'], $input['group_discussion']
);
 
$userResults = array();
}
else
{
$results = $searcher->searchGeneral($input['keywords'], $constraints, $input['order']);
 
$userResults = $this->_getUserSearch($input['keywords']);
}
 
if (!$results && !$userResults)
{
return $this->getNoSearchResultsResponse($searcher);
}
 
$warnings = $searcher->getErrors() + $searcher->getWarnings();
 
$search = $searchModel->insertSearch(
$results, $input['type'], $origKeywords, $constraints, $input['order'], $input['group_discussion'], $userResults,
$warnings, $visitorUserId
);
}
 
return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
XenForo_Link::buildPublicLink('search', $search),
''
);
}

Now the above link will work.

The presentation is different (shown as search results) because it's using the search system instead of what's new. But it's an easy hack since the search system already has the needed criteria.

How do i pull latest threads from one section or two sections? As search results? I dont know how the URLs work.
 
Top Bottom