WordPress – How to remove a large number of email-bounced users

One of my wordpress web sites has over 20,000 users. Most of these users were verified when they signed up for their account, but there are still a large number of bounce email I get every time I send out a user mailing. There are also a number of “unsubscribe” messages that I get.

I searched around for a plug-in that would allow me to upload a CSV file and would then bulk-delete the users but none was found. Instead of creating a new plug-in I decided to figure out a way of doing some form of bulk removal of users. Here is what I did (note: my site does not have any “contributor” users):

  1. For each bounce email or unsubscribe request I receive I copy the email address
  2. Execute this query in your wordpress database:[quote style=”boxed”] update wp_usermeta SET meta_value=’a:1:{s:11:”contributor”;s:1:”1″;}’ where meta_key=’wp_capabilities’ AND user_id= (SELECT ID from wp_users where user_email=’theuser@example.com’);[/quote]
  3. I repeat that for all users
  4. Go to the Users panel, click on “Contributors”
  5. Click the check mark all
  6. Bulk Delete

Again, this works for me because everyone is a “Subscriber” and the “Contributors” list is always empty so I use that to store my temporary delete list.

Fix for the WordPress Theme Studiopress for WordPressMU

The Studiopress theme for WordPressMU is broken. When you try to update the options you get the message “options page not found”. I have fixed the issue:
[code]
18a19
> if ( is_admin() ){ // admin actions
19a21,30
> add_action(‘admin_init’, ‘register_mysettings’ );
>
> } else {
> // non-admin enqueues, actions, and filters
> }
>
> function register_mysettings() { // whitelist options
>   register_setting( ‘Theme Options’, ‘greeting’ );
>   register_setting( ‘Theme Options’, ‘welcomemessage’ );
> }
27c38
<   <div class=’wrap’>

>   <div>
30a42,43
> <?php settings_fields(‘greeting,welcomemessage’); ?>
>
35c48
<   <p><input type=”submit” name=”Submit” value=”Update Options” /></p>

>   <p><input type=”submit” name=”Submit” value=”<?php _e(‘Update Options’); ?>” /></p>
37a51
> <?php settings_fields( ‘Theme Options’ ); ?>
43c57
< ?>
\ No newline at end of file

> ?>

[/code]