Info
- 4 posts
- 4 voices
- Started 4 years ago by akhater
- Latest reply from Detective
- This topic is not a support question
Extending the Private Forums Plugin
-
- Posted 4 years ago #
This is not a plugin just a quick hack to Aditya Naik ’s popular private forums plugin.
If, like me, you need to add some private forums in your BBPress setup but you don’t want to make those users moderators or administrators then here is how to add a custom rolehttp://www.onetouchinnovation.com/scripting/extending-bbpress-private-forums
-
- Posted 4 years ago #
Any update on why the Private Forum plugin will revert to 'Open For All.'
I consider this a large issue and can not believe bbpress does not have a proper configuration for this. Nevertheless, I am willing to wait and appreciate the effort going into bbpress. If I knew php I would try and fix this myself. -
- Posted 4 years ago #
I'm in the same boat as you, mciarlo. Every time I make a small change at the admin panel, I have to remember to go back to the Private Forums menu and change all the forums back to private. I've let it slip a few times...
-
- Posted 4 years ago #
I finally made a custom "private forum" (note the single noun) plugin:
define('FORO_STAFF', 22); add_filter('get_posts_where', 'ryuuko_staff_where_posts'); function ryuuko_staff_where_posts($where) { if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) { //var_dump($where); $where .= " AND p.forum_id <> '" . FORO_STAFF . "' "; } return $where; } add_filter('get_topics_where', 'ryuuko_staff_where_topics'); function ryuuko_staff_where_topics($where) { if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) { $where .= " AND t.forum_id <> '" . FORO_STAFF . "' "; } return $where; } add_filter('get_forums', 'ryuuko_staff_forums'); function ryuuko_staff_forums($forums) { if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) { $where .= " AND t.forum_id <> '" . FORO_STAFF . "' "; $forum_key = -1; foreach ($forums as $key => $forum) if (intval($forum->forum_id) == FORO_STAFF) { $forum_key = $key; break; } unset($forums[$key]); } return $forums; } add_action('bb_forum.php_pre_db', 'ryuuko_forum_redirect'); function ryuuko_forum_redirect($forum_id) { if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) { if ($forum_id == FORO_STAFF) bb_die("No puedes ver esto!"); } }Maybe it's useful for someone. The constant FORO STAFF is the id for the private forum. In this case, only users with the 'moderate' capability can see the forum.
-
You must log in to post.