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!
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?
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.
Thanks, that works! It would definitely be nice if there was just a checkbox on the forum page 🙂 🙂 but this works too.
Glad that worked! Yes I agree, noted 🙂