Topic: Showing last 10 posts

I'd like to replace the "Show recent posts" item in the footer to show the last 10 posts.  My site doesn't get enough traffic so showing the last 24hrs worth of posts is pretty useless.  Can anyone point me in the right direction?

Thanks!

2

Re: Showing last 10 posts

Although I have not done this and am not a pro at php, I would look into how posts are diplayed in a forum because they are ordered by date. Then I would use that and take out the limit for the forum number, and only get 10 topics.

Re: Showing last 10 posts

Try this?

Open: search.php

Find:

            // 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)) 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:

            // If it's a search for todays posts
            // mod: search for the X most recent 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) ORDER BY t.last_post DESC LIMIT 10') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); // AND t.last_post>'.(time() - 86400)
                $num_hits = $db->num_rows($result);

                if (!$num_hits)
                    message($lang_search['No recent posts']);
            }

4

Re: Showing last 10 posts

would extern.php not do this job?

Re: Showing last 10 posts

It could, but what file would you be calling it from?