MyBB Community Forums

Full Version: View recent posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a facility with mybb that allows the user to view recent posts, say to call up a chronological list of all posts made in the past week or whatever? I see the option of viewing new posts, or todays posts, but is there a more long term chronological list available?
This should do it.
Quote:http://<your_domain>/search.php?action=getdaily&days=7
cool, thanks Christian. That's pretty cool.
hmmm, actually, looking closer at the results, what it's giving me is a chronological list of the last posts on given threads. But it's not including posts prior to the last post on a given thread, even if those posts are chronologically more recent. Know what I mean? So in other words, it's not actually returning a chronological list of posts, it's more of a chronological list of threads. Not actually what I was after, but close...
That's what always happens. You won't get a list of recent posts, just whether or not there is a new post within a thread...and this could be more than one post in that thread, but of course that thread will only be listed once!
Try this modification:
In search.php, find this code block:
elseif($mybb->input['action'] == "getdaily")
{
	if($mybb->input['days'] < 1)
	{
		$days = 1;
	}
	else
	{
		$days = intval($mybb->input['days']);
	}
	$datecut = time()-(68400*$days);

	$where_sql = "t.lastpost >='".$datecut."'";

	if($mybb->input['fid'])
	{
		$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
	}
	
	$unsearchforums = get_unsearchable_forums();
	if($unsearchforums)
	{
		$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
	}
	$inactiveforums = get_inactive_forums();
	if($inactiveforums)
	{
		$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
	}


	$sid = md5(uniqid(microtime(), 1));
	$searcharray = array(
		"sid" => $db->escape_string($sid),
		"uid" => $mybb->user['uid'],
		"dateline" => time(),
		"ipaddress" => $db->escape_string($session->ipaddress),
		"threads" => '',
		"posts" => '',
		"searchtype" => "titles",
		"resulttype" => "threads",
		"querycache" => $db->escape_string($where_sql),
	);

	$plugins->run_hooks("search_do_search_process");
	$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
In the above, find this line:
		"resulttype" => "threads",
Change "threads" to "posts"
Thanks Dennis, that did it!