Remove from search

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Remove from search

Post by php_BB_Lover »

hi,
yoursite.com/search.php -> SEARCH OPTIONS
how can i remove one of my category [category1 id:20] with its all forums from search option?
i'm looking for a php solution not js!
thanks,
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4158
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove from search

Post by thecoalman »

Are you just trying to remove it from that list or limit who can search that forum entirely?
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

thecoalman wrote:
Sun Jun 28, 2020 4:08 am
Are you just trying to remove it from that list or limit who can search that forum entirely?
just remove it from yoursite.com/search.php
but they could be able to search from forum/topic page!
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4158
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove from search

Post by thecoalman »

Moved this to custom coding.

This is untested:

Open search.php, around line 1395 find:

Code: Select all

$vars = array('rowset');
extract($phpbb_dispatcher->trigger_event('core.search_modify_forum_select_list', compact($vars)));

foreach ($rowset as $row)
{
After add:

Code: Select all

	if ($row['forum_id'] == 20)
	{
		//  don't display
		continue;
	}
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

thecoalman wrote:
Sun Jun 28, 2020 4:59 am
This is untested:
thank you very much, it worked!
but i have to disable search entirely too [limit who can search that forum entirely]
because when they search it in the box, they see the search result any way,
would you please help me to do this too?
thanks,
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
warmweer
Jr. Extension Validator
Posts: 5585
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Remove from search

Post by warmweer »

php_BB_Lover wrote:
Sun Jun 28, 2020 7:37 am
but i have to disable search entirely too [limit who can search that forum entirely]
because when they search it in the box, they see the search result any way,
would you please help me to do this too?
thanks,
Have you tried group forum permissions: "can search the forum"?
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

warmweer wrote:
Mon Jun 29, 2020 12:02 am
Have you tried group forum permissions: "can search the forum"?
i'm working based on something else. not with group!
Last edited by Mick on Tue Jun 30, 2020 7:05 am, edited 1 time in total.
Reason: Removed unnecessary quoting,
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
warmweer
Jr. Extension Validator
Posts: 5585
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Remove from search

Post by warmweer »

php_BB_Lover wrote:
Mon Jun 29, 2020 5:33 am
i'm working based on something else. not with group!
I never implied you were working on something with groups.
php_BB_Lover wrote:
Sat Jun 27, 2020 6:42 pm
how can i remove one of my category [category1 id:20] with its all forums from search option?
i'm looking for a php solution not js!
The way I understand this is that you never want search results coming from a particular Category.
Then using the permission system can do just that (unless more is at hand and the information you supplied doesn't cover the case completely).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4158
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove from search

Post by thecoalman »

php_BB_Lover wrote:
Sun Jun 28, 2020 4:15 am
just remove it from yoursite.com/search.php
but they could be able to search from forum/topic page!
Whether they are using the search box in upper right, "search this forum" on individual forum or the main search page all of those searches are routed through search.php. If I understand correctly what you want to do it's not impossible but it's probably not going to be some simple edit either.

If you explain the reason there may be some other option.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4158
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove from search

Post by thecoalman »

warmweer wrote:
Mon Jun 29, 2020 10:48 am
The way I understand this is that you never want search results coming from a particular Category.
The way I'm understanding it is they want to allow searches from the "search this forum" search box but disallow results when they are using search.php directly.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

warmweer wrote:
Mon Jun 29, 2020 10:48 am
The way I understand this is that you never want search results coming from a particular Category. Then using the permission system can do just that (unless more is at hand and the information you supplied doesn't cover the case completely).
Yes. results not coming from a particular Category.
With permission system, it applies for all the users in that group. But im looking to apply for example for users with specific age.
Last edited by Mick on Tue Jun 30, 2020 7:10 am, edited 1 time in total.
Reason: Removed unnecessary full quoting.
Version: phpBB 3.3.0
Theme: default
Regards
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

thecoalman wrote:
Mon Jun 29, 2020 5:30 pm

Whether they are using the search box in upper right, "search this forum" on individual forum or the main search page all of those searches are routed through search.php. If I understand correctly what you want to do it's not impossible but it's probably not going to be some simple edit either.

If you explain the reason there may be some other option.
First i wanted that. But i changed my mind after editing search.php with your code.
Now i dont want users to search a particular category [category1 id:20] from anywhere.
Last edited by Mick on Tue Jun 30, 2020 7:11 am, edited 1 time in total.
Reason: Removed unnecessary full quoting.
Version: phpBB 3.3.0
Theme: default
Regards
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

thecoalman wrote:
Mon Jun 29, 2020 5:32 pm
warmweer wrote:
Mon Jun 29, 2020 10:48 am
No. results not coming from a particular category from anywhere.
Last edited by Mick on Tue Jun 30, 2020 7:03 am, edited 1 time in total.
Reason: Removed unnecessary quoting.
Version: phpBB 3.3.0
Theme: default
Regards
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 4158
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove from search

Post by thecoalman »

php_BB_Lover wrote:
Mon Jun 29, 2020 5:39 pm
Yes. results not coming from a particular Category.
With permission system, it applies for all the users in that group. But im looking to apply for example for users with specific age.
First create an "underage" group for them and add them to the group.

Next go to ACP >> Permissions Tab >> Click Forum Roles link on left.

In the text box "create forum role" name a new role, for example "Standard Access + Polls -Search", select "Standard Access + Polls" for "use settings from" and click submit.

Switch to the actions tab in the next screen and next to "Can search the forum" select "never". Click Submit in lower right.

Click the "forum permissions" link on left, select the forum you want to limit search. If the the underage group is listed in the lower right pane you first need to add them. Once added they will appear in top right pane. Highlight the group and click edit permissions. Set the role to "Standard Access + Polls -Search" for that forum.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

thank you for explaining very good. i did that. but how can i put users with for example age between 1 to 20 in "underage" group?
Last edited by Mick on Tue Jun 30, 2020 7:02 am, edited 1 time in total.
Reason: Removed unnecessary posting.
Version: phpBB 3.3.0
Theme: default
Regards
Locked

Return to “phpBB Custom Coding”