1 (edited by mujitsu 2009-01-28 16:09)

Topic: Disallow topics from appearing in "recent posts" results?

I'm receiving more posts than I would like in the buy/sell forum of my site. I was wondering if it is possible to allow posts to this buy/sell forum but not allow them to appear in the "recent posts" search. That way buy/sell topics won't overwhelm members when they click on "recent post." The other forums would remain unchanged.

The idea is that if members are interested in buy/sell forum, they could open it manually and search.

Is it possible to do this?

Thanks for any help!

Re: Disallow topics from appearing in "recent posts" results?

mujitsu wrote:

I'm receiving more posts than I would like in the buy/sell forum of my site. I was wondering if it is possible to allow posts to this buy/sell forum but not allow them to appear in the "recent posts" search. That way buy/sell topics won't overwhelm members when they click on "recent post." The other forums would remain unchanged.

The idea is that if members are interested in buy/sell forum, they could open it manually and search.

Is it possible to do this?

Thanks for any help!

I still haven't been able to figure this out. Would anyone know about this?  Thanks.

3 (edited by Tieguy 2009-03-04 01:27)

Re: Disallow topics from appearing in "recent posts" results?

In search.php, find:

            // If it's a search for new posts
            if ($action == 'show_new')
            {
                if ($pun_user['is_guest'])
                    message($lang_common['No permission']);

                $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>'.$pun_user['last_visit'].' 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 new posts']);
            }
            // 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']);
            }

Replace with:

            // If it's a search for new posts
            if ($action == 'show_new')
            {
                if ($pun_user['is_guest'])
                    message($lang_common['No permission']);

                $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>'.$pun_user['last_visit'].' AND t.moved_to IS NULL AND t.forum_id != *forumidhere*  ') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
                $num_hits = $db->num_rows($result);

                if (!$num_hits)
                    message($lang_search['No new posts']);
            }
            // 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 AND t.forum_id != *forumidhere* ') 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']);
            }

Be sure to replace *forumidhere* with the forum id of the buy/sell forum.

If you need any PunBB 1.2.* mods done, feel free to send me a PM; we can work out a price [if need be].

Re: Disallow topics from appearing in "recent posts" results?

Many thanks Tieguy!