I'm trying to prevent moderation of forum posts for users with the 'moderate' capability OR an active 'premium' membership plan (WC Memberships).
I want replies from such authors to not be subject to our moderation rules (number of links, blocklisted words, etc.).
I've tried using the following filters with no luck:
add_filter( 'bbp_bypass_check_for_moderation', 'bbp_bypass_if_user_can_moderate', 10, 4 );
function bbp_bypass_if_user_can_moderate( $anonymous_data, $author_id, $title, $content ){
if( user_can( $author_id, 'moderate' ) || wc_memberships_is_user_active_member( $author_id, 'premium' ) ){
return true;
} else {
return false;
}
}
add_filter( 'bp_bypass_check_for_moderation', 'bp_bypass_if_user_can_moderate', 10, 3 );
function bp_bypass_if_user_can_moderate( $user_id, $title, $content ){
if( user_can( $user_id, 'moderate' ) || wc_memberships_is_user_active_member( $user_id, 'premium' ) ){
return true;
} else {
return false;
}
}
It seems like the above code should work. Am I overlooking something?
Reference:
- https://www.buddyboss.com/resources/reference/functions/bbp_check_for_moderation/
- https://www.buddyboss.com/resources/reference/hooks/bp_bypass_check_for_moderation/
- https://developer.wordpress.org/reference/functions/user_can/
- https://docs.woocommerce.com/document/woocommerce-memberships-function-reference/#wc_memberships_is_user_active_member