bbPress do not allow Participants to create Topic Tags

Home Forums BulletProof Security Pro bbPress do not allow Participants to create Topic Tags

This topic contains 0 replies, has 1 voice, and was last updated by  AITpro Admin 1 year, 5 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #31883

    AITpro Admin
    Keymaster

    As of bbPress 2.5.12 this code no longer works in a Theme functions.php file and must be added in the BuddyPress /plugins/bp-custom.php file.  bbPress forum topic created for this issue on the bbPress site: https://bbpress.org/forums/topic/bbp_get_caps_for_role-filter-firing-too-late-and-not-being-processed/

    // bbPress Disable Topic Tags for Participants
    function aitpro_get_caps_for_role_filter( $caps, $role ) {
    	
    	if ( $role == 'bbp_participant' )
    		$caps = aitpro_get_caps_for_role( $role );
    
    	return $caps;
    }
     
    add_filter( 'bbp_get_caps_for_role', 'aitpro_get_caps_for_role_filter', 10, 2 );
    
    function aitpro_get_caps_for_role( $role ) {
    	switch ( $role ) {
    		/* Disable Topic Tags for Participants */
    		case 'bbp_participant':
    			return array(
     
    				// Primary caps
    				'spectate'              => true,
    				'participate'           => true,
    
    				// Forum caps
    				'read_private_forums'   => true,
    
    				// Topic caps
    				'publish_topics'        => true,
    				'edit_topics'           => true,
    
    				// Reply caps
    				'publish_replies'       => true,
    				'edit_replies'          => true,
    
    				// Topic tag caps
    				'assign_topic_tags'     => false, // Using false disables allowing Participants to create Topic Tags
    
    			);
    			break;
    		default :
    
    		return $role;
    	}
    }

    If for some reason the code above does not work then you can edit the /bbpress/includes/core/capabilities file directly at Code Line 202 and change the ‘assign_topic_tags’ value for participants from true to false. The Topic Tag text box will no longer be displayed for Participants.

    'assign_topic_tags'     => false, // do not allow participants to add topic tags - was true now false
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.