Topic: Recent Posts
I wonder, is there a way that I can get recent new posts in PunBB ?
You are not logged in. Please login or register.
PunBB Forums → Feature requests → Recent Posts
I wonder, is there a way that I can get recent new posts in PunBB ?
What do you mean? Like "Show new posts since last visit", which is already a feature, or a little box on your front page showing recent threads?
Have a look in this topic: http://punbb.org/forums/viewtopic.php?id=2494
What I was thinking of was something like "Todays Posts". It would just show the posts made in the last 24 hours. It would work exactly the same as Show Posts Since Last Visit but would work for people not logged in, new users, people who always delete their cookies and people surfing the board away from the regular PC i.e the PC that has the cookie on it.
There is also a more complicated system you see on some boards which allows you to limit the visible posts to the last days, 10 days, 20 days etc via a dropdown list.
Yup, I second this one as well. I think a simple link in the header for "Today's Posts" or "Active Topics" would be an excellent addition.
The best thing would have a link to a page like the ones discussed here:
http://punbb.org/forums/viewtopic.php?id=4160
but especially like cuteseal has at the bottom of the page here:
http://www.shuttertalk.com/forums/index.php
Dang that just looks REALLY sharp!
But, I've said it before, and saying it again.... "KISS" Keep It Simple..."
PunBB 1.2 has a link in the footer titled "Show recent posts" that shows you posts made within the last 24 hours. It works for guests as well as registered users.
Hey coding masters. I really like the "Show recent posts" link and I'm wondering if there is a way to hack / mod / change the time frame on it for, um... those of us with less popular forums. Like change it from 24 hours to 48, 72, etc.
Thanks in advance.
search.php (for last 72 hrs):
FIND
else if ($action == 'show_24h')
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400)) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No recent posts']);
}
Replace with
else if ($action == 'show_24h')
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 259200)) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No recent posts']);
}
Smartys, you rock! Sometimes I wish I spoke code as fluently as you guys do! Why did I waste all that time (MONTHS) playing Scorched Earth?
Question. Is the only change the time from 86400 seconds to 259200 seconds or were there other changes in there?
Thanks again!
No, no other changes
and thanks
In 1.2.16, the code to replace is a little bit different:
// If it's a search for todays posts
else if ($action == 'show_24h')
{
$result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.(time() - 86400).' AND t.moved_to IS NULL') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
$num_hits = $db->num_rows($result);
if (!$num_hits)
message($lang_search['No recent posts']);
}
But it still worked when I replaced it by the one suggested above. But I'd like to make sure that I didn't mess up the code.
Thanks.
PunBB Forums → Feature requests → Recent Posts
Powered by PunBB, supported by Informer Technologies, Inc.