Skip to:
Content
Pages
Categories
Search
Top
Bottom

restrict topic creation to specific forums


  • antonv
    Participant

    @antonv

    I needed to restrict participant topic creation to selected forums but allow replies to all topics in all forums. I came up with this solution

    function my_bbp_restrict_topic_creation( $can ) {
    		
    	$forum_id = array(18,22,56); //change your forum id
    
    	if ( ! bbp_is_user_keymaster() &&  bbp_is_single_forum() &&   !in_array( bbp_get_forum_id(),$forum_id) ) {
    		$can = false;	
    	}
    
    	return $can;
    
    }
    add_filter( 'bbp_current_user_can_publish_topics', 'my_bbp_restrict_topic_creation' );  

    Participants can only create topics in the three forums with IDs 18,22,and 56. Whereas the KeyMaster can create topics in all forums.

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    great – thanks for posting that useful tip 🙂

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