Skip to:
Content
Pages
Categories
Search
Top
Bottom

Latest Discussion – More Control

  • Hey everyone,

    I’m trying to do 3 things.

    1. I want posts inactive longer then a set time to not be propagated to the Latest Discussions on the forum Index.

    2. I want hidden private forums to not show up on the Latest Discussion list unless they would normally be allowed to see it.

    3. I want the forum name to show up in another column in the Latest Discussion list.

    I’m using the Private Forums plug-in, and Latest Discussion is only visible on my site from bbpress/index.

    For 1. I found a plug-in but it’s no longer supported and I couldn’t clean up the Syntax error myself.

    For 2 I can find nothing.

    For 3 using another forum post I’ve already edited my templates to include the extra column and I almost see how to do it myself, but I can’t see where to get the name of the forum from the topic.

    As always, thank you for whatever help you can offer.

Viewing 3 replies - 1 through 3 (of 3 total)
  • For 3, from the Genealogías theme:

    function gs_topic_forum_link() {
    global $topic;
    if ($topic) {
    echo '<a href="' . get_forum_link($topic->forum_id) . '">' . get_forum_name($topic->forum_id) . '</a>';

    }
    }

    For the private forums, i do the following (considering only one private forum, having id 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')) {
    $where .= " AND p.forum_id <> '22' ";
    }
    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 <> '22' ";
    }
    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')) {
    $forum_key = -1;
    foreach ($forums as $key => $forum)
    if (intval($forum->forum_id) == 22) {
    $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 == 22)
    bb_die("You can't see this!");
    }
    }

    I was looking to do #3 as well. This solution works like a champ. Thanks!


    _ck_
    Participant

    @_ck_

    Do not use the Private Forums plugin, it has not been updated in awhile and has bugs.

    Use my Hidden Forums plugin instead. The code above is not sufficient in itself.

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