• Resolved myronwittmer

    (@myronwittmer)


    Hello,
    I saw in the reviews that you helped someone with this.I want to be able to have a few forums that require approval and I need some that don’t require any moderation. Please help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Digital Arm

    (@digital-arm)

    Hi there,

    This snippet should moderate every topic and reply in certain forums. Just enter the forum ids in $lockdown_forum_ids. You would then set the Forum > Settings to not moderate.

    
    function my_lockdown_forum( $pending, $post ) {
    	$lockdown_forum_ids = array( 5, 50, 40 );
    	$forum_id = $post['post_parent'];
    
    	// Delete this if statement if you don't want to lock down replies
    	if ( 'reply' === $post['post_type'] ) {
    		$topic = get_post( $post['post_parent'] );
    		$forum_id = (int) get_post_meta( $topic->ID, '_bbp_forum_id', true );
    	}
    
    	if ( in_array( $forum_id, $lockdown_forum_ids )  ) {
    		$pending = true;
    	}
    
    	return $pending;
    }
    add_filter( 'bbp_modtools_moderate_post', 'my_lockdown_forum', 10, 2 );
    

    The other way to do it could be to set up the moderation settings in Forums > Settings then specify the forums you don’t want to moderate.

    
    function my_allowed_forums( $pending, $post ) {
    	$allowed_forum_ids = array( 5, 50, 40 );
    	$forum_id = $post['post_parent'];
    
    	// Delete this if statement if you don't want to allow all replies
    	if ( 'reply' === $post['post_type'] ) {
    		$topic = get_post( $post['post_parent'] );
    		$forum_id = (int) get_post_meta( $topic->ID, '_bbp_forum_id', true );
    	}
    
    	if ( in_array( $forum_id, $allowed_forum_ids )  ) {
    		$pending = false;
    	}
    
    	return $pending;
    }
    add_filter( 'bbp_modtools_moderate_post', 'my_allowed_forums', 10, 2 );
    

    Hope that helps!

    Thread Starter myronwittmer

    (@myronwittmer)

    Thanks, that would be a great solution howver it doesn’t hold the forums specified in “$lockdown_forum_ids” from posting. The go through like any other forum.

    I did change my moderation settings to none in Settings>Forums?Moderation Options

    I pasted the top section of code above into my functions.php file

    Any other suggestions?

    Plugin Author Digital Arm

    (@digital-arm)

    Actually, setting moderation to none means it won’t get to this filter.

    You could set moderation to custom and choose one of the options, perhaps English character threshold, and change it to 0. That should do the trick.

    Thread Starter myronwittmer

    (@myronwittmer)

    Thanks, that works! It would definitely be nice if there was just a checkbox on the forum page 🙂 🙂 but this works too.

    Plugin Author Digital Arm

    (@digital-arm)

    Glad that worked! Yes I agree, noted 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hold topics for approval on specific forums’ is closed to new replies.