Excluding Forums from 'View new posts'

Discussion forum for MOD Writers regarding MOD Development.
Locked
Freedom Fighter
Registered User
Posts: 59
Joined: Fri Dec 14, 2007 12:41 am

Excluding Forums from 'View new posts'

Post by Freedom Fighter »

Greetings

Could a kind soul possibly tell me how I could exclude choen forums from the "View unanswered posts • View new posts • View active topics" pages.

I'd like to be able to add the list of forums in an array if possible. for example...

Code: Select all


$excluded_forums = array( '12' , '3' , '41' , '4' , '6' );

 
Cheers in advance.

FF :)
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53379
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Excluding Forums from 'View new posts'

Post by Brf »

The simplest way is to use Forum Permissions to exclude those forums from search.
Freedom Fighter
Registered User
Posts: 59
Joined: Fri Dec 14, 2007 12:41 am

Re: Excluding Forums from 'View new posts'

Post by Freedom Fighter »

Brf wrote:The simplest way is to use Forum Permissions to exclude those forums from search.

Ahhh, I didn't realise that also worked on the View New posts and View active posts.

but ..... Problem is I would like the actual manual search function to continue to work on those forums.

Thanks for the suggestion though. :)
dennist
Registered User
Posts: 8
Joined: Tue Nov 11, 2008 6:44 pm

Re: Excluding Forums from 'View new posts'

Post by dennist »

Does anybody have an idea to solve this Problem?
Or is it impossible to realize like above?
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Excluding Forums from 'View new posts'

Post by A_Jelly_Doughnut »

In search.php, find

Code: Select all

			case 'newposts':
				$l_search_title = $user->lang['SEARCH_NEW'];
				// force sorting
Add this afterwards:

Code: Select all

$ex_fid_ary += 4;
If you want to exclude forum ID 4 from the newposts search. Add more similar lines if you want to exclude forum ID 5 and so on.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
dennist
Registered User
Posts: 8
Joined: Tue Nov 11, 2008 6:44 pm

Re: Excluding Forums from 'View new posts'

Post by dennist »

thanks, but I get this error message:

Code: Select all

Fatal error: Unsupported operand types in /www/htdocs/db4/final/search.php on line 347
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: Excluding Forums from 'View new posts'

Post by mtrs »

I put this

Code: Select all

$ex_fid_ary = array(42);
it worked, but I don't know, if would make a problem..
I abandoned all of my mods.
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Excluding Forums from 'View new posts'

Post by A_Jelly_Doughnut »

Yeah, the operator I meant to use was [].

Code: Select all

$ex_fid_ary[] = 4;
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: Excluding Forums from 'View new posts'

Post by EXreaction »

mtrs wrote:I put this

Code: Select all

$ex_fid_ary = array(42);
it worked, but I don't know, if would make a problem..
That could cause an issue, if you have any hidden forums which are hidden by permissions those would be visible during the search.

You could use:
$ex_fid_ary[] = 42;

or, if you want to add a bunch (just list more in the array):
$ex_fid_ary = array_merge($ex_fid_ary, array(42));
dennist
Registered User
Posts: 8
Joined: Tue Nov 11, 2008 6:44 pm

Re: Excluding Forums from 'View new posts'

Post by dennist »

thanks a lot, it is working now.
mtrs
Registered User
Posts: 2049
Joined: Sat Sep 22, 2007 2:39 pm

Re: Excluding Forums from 'View new posts'

Post by mtrs »

EXreaction wrote:You could use:
$ex_fid_ary[] = 42;

or, if you want to add a bunch (just list more in the array):
$ex_fid_ary = array_merge($ex_fid_ary, array(42));
Thank you, I made a small mod using this info..
http://www.phpbb.com/community/viewtopi ... &t=1390235
I abandoned all of my mods.
Locked

Return to “[3.0.x] MOD Writers Discussion”