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
rxu
Extensions Development Team
Posts: 3267
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Remove from search

Post by rxu »

php_BB_Lover wrote:
Wed Jul 01, 2020 1:54 am
I think its in this file
You can try (not tested):

Code: Select all

FIND
$not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";

BEFORE ADD
$ex_fid_ary[] = 20;
User avatar
EA117
Registered User
Posts: 1674
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Remove from search

Post by EA117 »

rxu wrote:
Wed Jul 01, 2020 2:39 am

Code: Select all

BEFORE ADD
$ex_fid_ary[] = 20;
Serious question. He's saying match a category (ID 20), and "all the forums under that category." Is the suggested code still sufficient? I'm not very versed in SQL or the table arrangement, so the reason this works may just not be obvious to me.

Certainly agreed that "throwing it into the $ex_fid_ary array" (same as simply using the permissions system would have) seems like the logical approach.
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

rxu wrote:
Wed Jul 01, 2020 2:39 am
You can try (not tested):

Code: Select all

FIND
$not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : "";

BEFORE ADD
$ex_fid_ary[] = 20;
thank you,
this only works for a single forum,
i need to apply it for a category, because there are lots of forums inside each category.
i wanna disable search of : [category1 id:20]
how can i get all the forums in an array and then put it in $ex_fid_ary[] ?
thanks
Last edited by php_BB_Lover on Wed Jul 01, 2020 6:37 am, edited 1 time in total.
Version: phpBB 3.3.0
Theme: default

Regards
rxu
Extensions Development Team
Posts: 3267
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Remove from search

Post by rxu »

php_BB_Lover wrote:
Wed Jul 01, 2020 4:12 am
how can i get all the forums inside them in an array
Well, in this case the simpliest way is just enumerating all of IDs you need, like

Code: Select all

$ex_fid_ary = array_merge($ex_fid_ary, [20, 21, 22, 23, 24]);
If you want to automate getting all child forums, it'll require additional SQL query and more coding.
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

rxu wrote:
Wed Jul 01, 2020 4:32 am
If you want to automate getting all child forums, it'll require additional SQL query and more coding.
i need it to get automatically by category ids
because i cant edit core files each time i add a new forum to that categories!
why phpBB doesn't have a function to get all the forums of a specific category?
Version: phpBB 3.3.0
Theme: default

Regards
rxu
Extensions Development Team
Posts: 3267
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Remove from search

Post by rxu »

php_BB_Lover wrote:
Wed Jul 01, 2020 4:48 am
why phpBB doesn't have a function to get all the forums of a specific category?
phpBB does have it all.
F.e. https://github.com/phpbb/phpbb/blob/mas ... n.php#L294

Example would be like that:

Code: Select all

include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);

$ex_forum_ids = [];
$forum_branch = get_forum_branch(20, 'children', true);
foreach ($forum_branch as $forum_data)
{
	$ex_forum_ids[] = $forum_data['forum_id'];
}
$ex_fid_ary = array_merge($ex_fid_ary, $ex_forum_ids);
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

rxu wrote:
Wed Jul 01, 2020 5:01 am
Example would be like that:
Thank you very much, it works perfectly!
Last edited by php_BB_Lover on Wed Jul 01, 2020 9:48 am, edited 1 time in total.
Version: phpBB 3.3.0
Theme: default

Regards
User avatar
warmweer
Jr. Extension Validator
Posts: 4750
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Remove from search

Post by warmweer »

Just popping in I'm seeing a disaster in the making.

Credit to rxu and others for the assistance to php_BB_Lover but is it really worth it?
For one, this topic has now covered access (and blocking of access) to forums based on language, age groups, limiting the search feature, and now something with the Jumpbox.
Yes it is the Custom Coding forum so it fits in a way ... BUT
  1. php_BB_lover clearly lacks some basic understanding of the functioning of phpBB, the permission system in particular
  2. using custom code to do something phpBB out of the box can already do is .. errrr, I'll put it mildly: not the best idea
  3. as thecoalman mentioned: the request isn't always clear and even misleading and changes as the topic progresses
  4. taking a) and b) into consideration - updates and (God forbid) upgrades are going to be "fun"
My suggestion to php_BB_lover is to provide a full (thorough) description of his wants/needs and based on that:
see what can be done with default phpBB or with extensions (perhaps by adding to the auto_groups), even contemplating setting up 2 boards (with different languages).

Just my 2 eurocents.
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
KevC
Support Team Member
Support Team Member
Posts: 69992
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Remove from search

Post by KevC »

What's the bigger explanation of this?

What is it about that forum that you want to completely hide? If it's a VIP forum there are built in ways to do it.

It helps enormously to explain what you want and why rather than how you think it should be done.
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"
User avatar
david63
Registered User
Posts: 17942
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Remove from search

Post by david63 »

KevC wrote:
Wed Jul 01, 2020 10:02 am
What's the bigger explanation of this?
From other topics my guess is that the board has two categories (may have more) where one is in English and one is in Spanish and the objective is that a user only sees the part of the board that is in their language.

All of this can be achieved with the permissions/groups system built in but somehow the OP wants it automated.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
KevC
Support Team Member
Support Team Member
Posts: 69992
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Remove from search

Post by KevC »

Yeah I've sort of got the gist of that odd setup. But then wouldn't you want two instances of the removal depending on which language you had? Without explanation it's hard to tell.
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"
User avatar
david63
Registered User
Posts: 17942
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: Remove from search

Post by david63 »

KevC wrote:
Wed Jul 01, 2020 10:11 am
Yeah I've sort of got the gist of that odd setup. But then wouldn't you want two instances of the removal depending on which language you had? Without explanation it's hard to tell.
Yes - but I don't think he has thought that through yet :roll:
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

david63 wrote:
Wed Jul 01, 2020 10:08 am
All of this can be achieved with the permissions/groups system built in but somehow the OP wants it automated.
i couldn't do it with permissions. but with editing the code works perfectly. big thanks to @thecoalman and @rxu
Version: phpBB 3.3.0
Theme: default

Regards
php_BB_Lover
Registered User
Posts: 173
Joined: Tue Jun 23, 2020 5:18 am

Re: Remove from search

Post by php_BB_Lover »

KevC wrote:
Wed Jul 01, 2020 10:11 am
Without explanation it's hard to tell.
it was based on language!
Version: phpBB 3.3.0
Theme: default

Regards
User avatar
KevC
Support Team Member
Support Team Member
Posts: 69992
Joined: Fri Jun 04, 2004 10:44 am
Location: Oxford, UK
Contact:

Re: Remove from search

Post by KevC »

If you don't want the two language groups to mix (and it's highly unlikely anyone will swap languages - by hiding one set of forums from the other they won't even know they exist anyway) why not just set up two boards?
-:|:- Support Request Template -:|:-
Image
Cheap UK Hosting
"In the land of the blind the little green bloke with no pupils is king - init!"
Post Reply

Return to “phpBB Custom Coding”