bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Latest Discussion - More Control

(2 posts)
  • Started 4 months ago by Sachrilege
  • Latest reply from Detective
  • This topic is not resolved
  1. 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.

    Posted 4 months ago #
  2. 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!");
    	}
    }
    Posted 4 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.