1

Topic: "Unanswered topics" command modification

Hello,
I want to change "Unanswered topics" command behaviour.

I want it to show topics that are not closed and that are not older than 1 year.

I found out that have to change line 694 of .\include\search_functions.php

'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.num_replies=0 AND t.moved_to IS NULL',

I have to add:

t.last_post>'.(time() - 946080000).' AND 

where 946080000 is seconds for one year. 60*60*24*30*365

Is this correct?

..

How to filter out Closed topics?

Using PunBB since 2006 at Forex Forum

2

Re: "Unanswered topics" command modification

sad

t.last_post>'.(time() - 946080000).' AND 

Doesn't work.

I googled further and changed it to

t.last_post>'.strtotime("-1 year", time()).' AND

It works fine.


Remains the problem with Closed status.

Using PunBB since 2006 at Forex Forum

3

Re: "Unanswered topics" command modification

Filtering out closed topics

t.closed=0
Using PunBB since 2006 at Forex Forum

4

Re: "Unanswered topics" command modification

I think, you should write an extension for this change. Updating PunBB will be simpler. Modifing extension also.

5

Re: "Unanswered topics" command modification

Extension will be nice. It will allow setting of TimeSpan interval, option for excluding closed topics and optionally filtering out selected forums.
For example my forum has a General category, which I'm not interested to read frequently. I need to see only my specified categories in New Posts and Active Discussions.

In details I want New Posts to show posts only from Category #3.

First I added  to the request 'show_new' at line 450

'WHERE'        => 'f.cat_id=3 AND (fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$forum_user['last_visit'].' AND t.moved_to IS NULL',

It works for "New Posts" link that is below the forum nav menu bar but it breaks the New posts link that appear next to the forum title for the forums in other categories.

So my second attempt is to change line 454 to:


            if ($value == -1)
                $query['WHERE'] .= ' AND f.cat_id=3';
            else
                $query['WHERE'] .= ' AND f.id='.$value;

Actually I'm not sure what exactly $value is when searching new posts. I only suppose that  $value == -1 when using the top link and $value is the number of the forum when we use the forum link.

Is this correct?

Using PunBB since 2006 at Forex Forum