Skip to:
Content
Pages
Categories
Search
Top
Bottom

Extending the Private Forums Plugin

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.


    citizenkeith
    Participant

    @citizenkeith

    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…

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar