How to Bulk Suspend BuddyPress or BuddyBoss Users
Running a BuddyBoss or BuddyPress site is awesome, but managing tons of users? That’s a headache. Need to suspend a bunch for spamming or breaking rules? Doing it one by one in the WordPress admin is painfully slow, and BuddyBoss offers no bulk suspension tool.
We hit this snag with about 320 users and found no simple solution. So, we crafted the BuddyBoss Bulk Suspend/Activate Users plugin to suspend or reactivate hundreds of users with just a few clicks. It handles the wp_bp_suspend
table behind the scenes, but don’t worry—it’s super user-friendly, even if code’s not your thing.

Let’s dive into how it works, and why it saves time!
Contents
Why We Built This Plugin
We had to suspend around 320 users on a client’s BuddyBoss community. Some were inactive, others were spammy—it was a mix. Going into the WordPress Users panel and suspending each one individually would’ve taken forever.
No Good Options
We poked around BuddyBoss’s moderation tools, hoping for a bulk action feature. Nope, nothing. We also checked out other plugins, but they didn’t play nice with BuddyBoss/Buddypress. Especially for a large number of users.
Database? Yikes!
We thought about manually updating the wp_bp_suspend
table—you know, the database spot where BuddyBoss keeps track of suspensions. But here’s the thing: one wrong move in the database can mess up your whole site. Plus, most of our team isn’t comfy writing database queries. We needed something safer.
What We Wanted
We were after a tool that was:
- Super Simple: Something anyone on our team could use, techy or not.
- Safe: No accidental site-breaking moments.
- Fast: Able to handle hundreds of users without slowing things down.
- Flexible: Easy to pick which users to suspend or activate.
That’s where our plugin comes in. It gives you a friendly interface right in your WordPress admin panel. All you do is update a list of email addresses, click a button, and boom—done!
How the Plugin Works
What’s It Do?
This plugin is all about keeping things easy. It adds a new page in your WordPress admin called “User Status.” That’s your command center for bulk suspending or activating users.
The Buttons
Head to the “User Status” page, and you’ll see two buttons: “Suspend Users” and “Activate Users.” Pick one, click it, and the plugin takes care of the rest. It’s that simple.
Your List of Emails
The plugin has a list of email addresses you can edit. These are the users you want to suspend or activate. You just swap out the example emails with your own, and you’re good to go.
Behind the Scenes
When you hit a button, the plugin updates the wp_bp_suspend
table in your database. If you’re suspending users, it adds records to mark them as suspended. If you’re activating them, it clears those records to give them access again.
Keeping You in the Loop
Once it’s done, the plugin tells you how many users were updated. If something goes wrong—like an email doesn’t match a user—it’ll list those so you can fix them. Oh, and it’s got WordPress’s built-in security to keep things locked down, plus it’s fast even with big lists.
Breaking Down the Plugin Code
Let’s peek under the hood and see how this plugin ticks. Don’t worry if you’re not a developer—I’ll keep it super straightforward. We’ll go through each part and toss in a few code snippets to show you what’s going on. You see the full plugin file (bulk-suspend-buddyboss-users.php
) below if you want.
1. Setting Up the Plugin
First up, the plugin tells WordPress who it is—name, description, all that jazz. Then it adds a “User Status” menu item to your admin panel. It’s done with a bit of code called a “hook.”
Check it out:
add_action('admin_menu', 'buddyboss_bulk_status_menu');
function buddyboss_bulk_status_menu() {
add_menu_page(
'Bulk User Status',
'User Status',
'manage_options',
'bulk-user-status',
'bulk_user_status_page',
'dashicons-admin-users',
20
);
}
When you log into WordPress, you’ll spot “User Status” in the menu with a little people icon. Easy to find, right?
2. The User Status Page
Click “User Status,” and you’ll land on a page with a simple form. It’s got two buttons: “Suspend Users” and “Activate Users.” This page comes from the bulk_user_status_page
function.
Here’s the button part:
<form method="post">
<?php wp_nonce_field('bulk_user_status_action', 'bulk_user_status_nonce'); ?>
<button name="action" value="suspend" class="button button-primary">Suspend Users</button>
<button name="action" value="activate" class="button button-secondary">Activate Users</button>
</form>
There’s a security thing called a “nonce” in there to make sure only legit admins can use it. Keeps things safe!
3. What Happens When You Click
When you hit a button, the plugin checks that everything’s legit with that nonce. Then it figures out which button you clicked—suspend or activate. It hands the job off to the update_user_suspension
function, which does the real work.
4. Making the Magic Happen
The update_user_suspension
function is where the action happens. Here’s the breakdown:
- Email List: There’s a list of emails in the code. You’ll edit this to include the users you want to suspend or activate.
Here’s how it looks:
$emails = [
'email1@hotmail.com',
'email2@gmail.com',
// Add your 300 emails here...
];
- Finding Users: The plugin checks each email to see if it matches a user on your site. If an email doesn’t exist, it gets flagged as an error.
- Suspending Users: For “Suspend,” it adds a record to the
wp_bp_suspend
table. That’s what blocks the user’s access. - Activating Users: For “Activate,” it deletes the suspension record, letting the user back in.
- Tracking Everything: The plugin counts how many users got updated and notes any errors, like emails that didn’t work.
5. Getting Feedback
When it’s done, you’ll see a friendly message. A green one tells you how many users were updated—sweet! A red one lists any emails that didn’t work, like if there was a typo. This way, you know exactly what happened.
How to Use This Plugin
Ready to try it out? Here’s how to get it running on your BuddyBoss-powered WordPress site. I’ll assume you’re okay installing plugins but might need a hand with the rest.
Step 1: Grab the Plugin File
Copy the plugin code (it’s down below) into a file called bulk-suspend-buddyboss-users.php
.
Step 2: Tweak the Email List
Open the plugin file in a text editor—something like Notepad++ or VS Code works. If that sounds daunting, then your hosting provider’s file manager can do the trick too. Look for the email list in the update_user_suspension
function:
$emails = [
'email1@hotmail.com',
'email2@gmail.com',
// Add your 300 emails here...
];
Swap out those example emails with the ones for your users. Like this:
$emails = [
'john.doe@example.com',
'jane.smith@example.com',
'user123@example.com',
];
Make sure each email is in quotes, has a comma after it, and the list ends with a semicolon (;
). Got a spreadsheet of emails? You can copy-paste, just double-check the format. Save the file and proceed to the next step.
Step 3: Install It
Zip your bulk-suspend-buddyboss-users.php
file (right-click it, select “Compress” or “Send to > Compressed folder,” and name it bulk-suspend-buddyboss-users.zip
). Then, in your WordPress admin, go to Plugins > Add New > Upload Plugin, upload the .zip file, click Install Now, and hit Activate. Nice and simple!
Step 4: Run the Action
Go to User Status in your WordPress admin—you’ll see the people icon in the menu. Click either Suspend Users or Activate Users, depending on what you’re doing. Give it a few seconds to work its magic.
Step 5: Check How It Went
You’ll get a message showing how many users were updated. If any emails didn’t work (maybe a typo or the user doesn’t exist), it’ll list those so you can fix them.
Step 6: Do It Again Anytime
Need to suspend or activate more users? Just update the email list and repeat. It’s that simple.
Tips for Non-Techy Folks
- Email List Help: If editing the email list feels tricky, grab a friend who’s okay with text files. It’s really just pasting emails, but the quotes and commas gotta be right.
- Test It Out: Try it with just 2–3 emails first. That way, you know it’s working before you go big.
- Back Up First: Always back up your WordPress database before doing bulk stuff. It’s like a safety net in case something goes wonky.
- Double-Check Emails: Make sure the emails you use match what’s in your WordPress Users panel. Even a tiny typo will cause a hiccup.
The Full Plugin Code
Here’s the complete code for the plugin. Copy it into a file named bulk-suspend-buddyboss-users.php
and follow the steps above to get started.
<?php
/**
* Plugin Name: BuddyBoss Bulk Suspend/Activate Users
* Description: A plugin to bulk suspend or activate BuddyBoss users by directly updating the wp_bp_suspend table.
* Version: 1.0
* Author: iConnect Media
* Author URI: https://iconnect-media.com
* License: GPL2
*/
// Hook to add admin menu
add_action('admin_menu', 'buddyboss_bulk_status_menu');
function buddyboss_bulk_status_menu() {
add_menu_page(
'Bulk User Status',
'User Status',
'manage_options',
'bulk-user-status',
'bulk_user_status_page',
'dashicons-admin-users',
20
);
}
// Admin page for the plugin
function bulk_user_status_page() {
?>
<div class="wrap">
<h1>Bulk Suspend/Activate BuddyBoss Users</h1>
<form method="post">
<?php
// Nonce field for security
wp_nonce_field('bulk_user_status_action', 'bulk_user_status_nonce');
?>
<button name="action" value="suspend" class="button button-primary">Suspend Users</button>
<button name="action" value="activate" class="button button-secondary">Activate Users</button>
</form>
</div>
<?php
// Handle the form submission
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['bulk_user_status_nonce'])) {
if (!wp_verify_nonce($_POST['bulk_user_status_nonce'], 'bulk_user_status_action')) {
wp_die('Security check failed!');
}
$action = sanitize_text_field($_POST['action']);
if ($action === 'suspend' || $action === 'activate') {
$suspend = ($action === 'suspend') ? 1 : 0;
$result = update_user_suspension($suspend);
// Display feedback
if ($result['success']) {
echo '<div class="notice notice-success is-dismissible">';
echo '<p>Successfully updated ' . $result['updated'] . ' users to "' . ($suspend ? 'Suspended' : 'Active') . '".</p>';
echo '</div>';
}
if (!empty($result['errors'])) {
echo '<div class="notice notice-error is-dismissible">';
echo '<p>Failed to update the following emails: ' . implode(', ', $result['errors']) . '</p>';
echo '</div>';
}
}
}
}
// Function to update user suspension
function update_user_suspension($suspend) {
global $wpdb;
$emails = [
'email1@hotmail.com',
'email2@gmail.com',
// Add your 300 emails here...
];
$updated = 0;
$errors = [];
foreach ($emails as $email) {
$user = get_user_by('email', $email);
if ($user) {
$user_id = $user->ID;
if ($suspend) {
// Add or update suspension record
$result = $wpdb->replace(
"{$wpdb->prefix}bp_suspend",
[
'item_id' => $user_id,
'item_type' => 'user',
'hide_sitewide' => 1,
'hide_parent' => 0,
'user_suspended' => 1,
'reported' => 0,
'user_report' => null,
'last_updated' => current_time('mysql', 1)
],
[
'%d', // item_id
'%s', // item_type
'%d', // hide_sitewide
'%d', // hide_parent
'%d', // user_suspended
'%d', // reported
'%s', // user_report
'%s', // last_updated
]
);
} else {
// Remove suspension record for this user
$result = $wpdb->delete(
"{$wpdb->prefix}bp_suspend",
['item_id' => $user_id, 'item_type' => 'user'],
['%d', '%s']
);
}
if ($result !== false) {
$updated++;
} else {
$errors[] = $email;
}
} else {
// Error if user not found
$errors[] = $email;
}
}
return [
'success' => $updated > 0,
'updated' => $updated,
'errors' => $errors,
];
}
?>
Wrapping It Up
We built our BuddyBoss Bulk Suspend/Activate Users plugin as an internal tool to make suspending or activating tons of users quick and painless. Honestly, we didn’t plan to share it—it’s a bit rough around the edges, and yeah, the interface could be fancier. But it gets the job done, and we figured, why not turn it into a tutorial to help out the community.
With just a couple of clicks and an easy-to-edit email list, you can save hours of tedious work. We know it’s not perfect, but it’s super practical, especially if tech isn’t your jam. We hope this guide showed you how to use it and why it’s a lifesaver. Got questions or need help getting it set up? Reach out to us at iConnect Media or drop a comment below. Here’s to smoother community management—happy suspending!