1

Topic: Recent Posts

I wonder, is there a way that I can get recent new posts in PunBB ?

Re: Recent Posts

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?

-

Re: Recent Posts

Have a look in this topic: http://punbb.org/forums/viewtopic.php?id=2494

"Programming is like sex: one mistake and you have to support it for the rest of your life."

4

Re: Recent Posts

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.

Re: Recent Posts

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..."

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

Re: Recent Posts

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.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Recent Posts

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.

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

Re: Recent Posts

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']);
            }

Re: 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!

Rob Ludlow 
www.Nifty-Stuff.com - Repository of all Stuff Nifty!
www.reviewum.com - Professor Ratings + Teacher Reviews

10 (edited by Smartys 2005-05-06 23:26)

Re: Recent Posts

No, no other changes
and thanks wink

Re: Recent Posts

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.

If you do what you've always done, you'll get what you've always gotten.