Skip to content

Instantly share code, notes, and snippets.

@dwanjuki
Last active June 17, 2025 07:45
Show Gist options
  • Save dwanjuki/fcedcc92888513e4e6d5fda8ed592167 to your computer and use it in GitHub Desktop.
Save dwanjuki/fcedcc92888513e4e6d5fda8ed592167 to your computer and use it in GitHub Desktop.
Stop Extra Expiration Warning Emails being sent for suspended BuddyBoss members
<?php
/*
* Stop Extra Expiration Warning Emails being sent for suspended BuddyBoss members.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmproeewe_buddyboss_suspended_members( $send, $euser ) {
// Bail if the email is not being sent to this user already.
if ( ! $send ) {
return $send;
}
// Bail if BuddyBoss is not active, or if the Moderation component is not enabled.
if ( ! function_exists( 'bp_is_active' ) || ! bp_is_active( 'moderation' ) ) {
return $send;
}
// If the user is suspended, they should not receive EEW emails.
if ( bp_moderation_is_user_suspended( $euser->ID ) ) {
$send = false;
}
return $send;
}
add_filter( 'pmproeewe_send_reminder_to_user', 'my_pmproeewe_buddyboss_suspended_members', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment