Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if auto-suspend is enabled before setting threshold #4341

Merged
merged 11 commits into from
May 14, 2024
6 changes: 3 additions & 3 deletions src/bp-moderation/classes/class-bp-moderation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,8 @@ public function save() {
$auto_hide = false;

if ( BP_Moderation_Members::$moderation_type === $this->item_type && ( bp_is_moderation_auto_suspend_enable() || bb_is_moderation_auto_suspend_report_enable() ) ) {
$threshold = bp_moderation_auto_suspend_threshold( 5 );
$user_threshold = bb_moderation_auto_suspend_report_threshold();
$threshold = bp_is_moderation_auto_suspend_enable() && bp_moderation_auto_suspend_threshold( 5 );
$user_threshold = bb_is_moderation_auto_suspend_report_enable() ? bb_moderation_auto_suspend_report_threshold() : false;
$email_notification = bp_is_moderation_blocking_email_notification_enable();
} elseif ( bp_is_moderation_auto_hide_enable( false, $this->item_type ) ) {
$threshold = bp_moderation_reporting_auto_hide_threshold( '5', $this->item_type );
Expand Down Expand Up @@ -1133,7 +1133,7 @@ public function save() {
$this->hide_sitewide = 1;
$auto_hide = true;
}
if ( BP_Moderation_Members::$moderation_type === $this->item_type && $this->count_report >= $user_threshold && empty( $this->hide_sitewide ) ) {
if ( BP_Moderation_Members::$moderation_type === $this->item_type && ( ! empty( $user_threshold ) && $this->count_report >= $user_threshold ) && empty( $this->hide_sitewide ) ) {
$this->hide_sitewide = 1;
$auto_hide = true;
}
Expand Down