Page 1 of 1

Filtering out Private Forums

Posted: Mon Jul 04, 2022 4:49 pm
by Murdock
Hi,

I tried searching, but probably because of the common words, I couldn't find this specific topic...

Does anyone know how to filter out specific private forums from being displayed in the widget? I have a private 'Admins Only' forum (and others), and I just noticed that the WP W3all phpBB integration widget is displaying the posts in that forum. In other pbpBB plugins (prior to wordpress), I have been able to select forms, and indicate that I don't want them to appear, unless the user is logged in and has that security. At this point, I don't mind if the security is not applied, I would just like to exclude those forums. If I had to, I could go in and add "ForumID not in ('18')", but I am not sure where to look. Any suggestions?

Thanks,
Murdock

Re: Filtering out Private Forums

Posted: Thu Jul 07, 2022 6:01 pm
by axew3
for widgets:
/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php

Code: Select all

private static function last_forums_topics($ntopics = 10){

Code: Select all

   $topics = $w3all_phpbb_connection->get_results("SELECT T.*, P.*, U.*
    FROM ".$w3all_config["table_prefix"]."topics AS T
    JOIN ".$w3all_config["table_prefix"]."posts AS P on (T.topic_last_post_id = P.post_id and T.forum_id = P.forum_id)
    JOIN ".$w3all_config["table_prefix"]."users AS U on U.user_id = T.topic_last_poster_id
    WHERE T.topic_visibility = 1
    ".$topics_x_ugroup."
    AND P.post_visibility = 1
    ORDER BY T.topic_last_post_time DESC
    LIMIT 0,$ntopics");
may change this into:

Code: Select all

   $topics = $w3all_phpbb_connection->get_results("SELECT T.*, P.*, U.*
    FROM ".$w3all_config["table_prefix"]."topics AS T
    JOIN ".$w3all_config["table_prefix"]."posts AS P on (T.topic_last_post_id = P.post_id and T.forum_id = P.forum_id)
    JOIN ".$w3all_config["table_prefix"]."users AS U on U.user_id = T.topic_last_poster_id
    WHERE T.topic_visibility = 1
    ".$topics_x_ugroup."
    
    AND T.forum_id != 18
    
    AND P.post_visibility = 1
    ORDER BY T.topic_last_post_time DESC
    LIMIT 0,$ntopics");
but there is an option into plugin admin page, to exclude directly forums on widgets
while if you want to edit by groups the query, may the query to edit is this (same function):

Code: Select all

// this need to be adjusted if 'phpBB default schema' isn't the used one
$gaf = $w3all_phpbb_connection->get_results("SELECT DISTINCT ".$w3all_config["table_prefix"]."acl_groups.forum_id FROM ".$w3all_config["table_prefix"]."acl_groups
 WHERE ".$w3all_config["table_prefix"]."acl_groups.auth_role_id != 16
  AND ".$w3all_config["table_prefix"]."acl_groups.group_id = ".$ug."");

Re: Filtering out Private Forums

Posted: Mon Jul 11, 2022 3:25 am
by Murdock
Excellent!

It worked perfectly!!!

Thanks! / Grazie!

Murdock

Re: Filtering out Private Forums

Posted: Mon Jul 11, 2022 3:59 am
by Murdock
I just added the line to the sql...and that did work...So I went to post a note in a special forum I have for just my site customization notes...and after posting it, I noticed the new post didn't appear on the front page. That told me, I must have set that up as a not visible forum when I set up w3all...

and I saw where you said...
axew3 wrote:but there is an option into plugin admin page, to exclude directly forums on widgets
I looked and looked before, but I couldn't find the option. I thought there was one, but I went for the code as the quick fix.

So I went back clicking in WP, and found the WP w3all settings page, and the setting I was looking for was right there!

(I added the 18 before the screenshot.)
Screenshot 2022-07-10 234707.PNG.jpg
Screenshot 2022-07-10 234707.PNG.jpg (52.96 KiB) Viewed 1414 times
Thanks for pointing me in the right direction!
Murdock