BB Press Users Cleanup
I finally got around to removing all the bot-users (about 3100 in total) that had registered in my BB Press Forum. Here’s what I did. It’s not for the novice, and I don’t take responsibility for anything that blows up. Of course, always backup first.
Step 1:
Installed Human Test for BB Press
Step 2:
Used AmR-Users to generate a CSV list of bot users by generating a report that excluded user levels of 0,1,2,3,4,5,6,7,8,9,10 and making the id visible.
Note – my BB Press installation is integrated with Wordpress, so they share the same users tables. This method would only work in that case, because if the user doesn’t validate their email address, then it’s not set up with a role in WordPress.
Step 3:
Used Excel to reformat the list – creating a list of all the ID’s, with a comma after.
Step 4:
I wrote a quick script to actually delete the users. The array part was 3100 lines long, just a copy and paste from Excel.
<?php
/*
Plugin Name: Bot Cleanup
Description: Get rid of BBpress bot users.
Version: 0.1
*/
function wphive_delete_now() {
$ids = array(
1856,
1857,
1234
);
if ($_REQUEST['delete'] == 'now') {
require_once(ABSPATH.'/wp-admin/includes/user.php');
foreach ($ids as $id) {
wp_delete_user( $id );
}
}
}
add_action('init', 'wphive_delete_now');
?>
Step 5:
Installed it as a plugin in WordPress and activated it. Don’t forget to uninstall it and delete it after you are done.
Step 6:
Loaded up my website with the appropriate GET to activate it:
http://domain.com/index.php?delete=now and Voila! all those spammy users disappeared. I actually had to load it twice because it timed out the first time after deleting about 2400 users.
Web Design Partner
I’ve been getting excellent feedback and response from my main project, WP Hive. Alas, even though it’s not well advertised that I offer custom-plugin-development services, I am getting regular requests from individuals who need various WordPress Web-Development jobs done.
Coincidentally (or perhaps not), I am also getting regular requests for Web Design work. The problem is that I prefer to focus on what I do best, which is writing great software. As a result, I’ve had to turn down a number of requests for designing themes and other various work on the WordPress front-end.
Instead of turning these clients away, I would like to send them to someone who can take care of the customer the same way I would. In return, I would expect to get some leads back.
Ideally I would like to work with someone who:
- Has existing clients and a portfolio of work.
- Has a proven method of generating leads and finding new jobs.
- Has had to turn down requests for web-development, in favor of specializing in web-design.
- Is serious about running this venture as business.
The idea is that this would be an on-going symbiotic relationship.
If you are interested in exploring this type of partnership, please contact me.
I found that the existing solution for using pretty permalinks with Wordpress and IIS is good and lightweight, but I needed something a little more robust that fixed as many differences as possible between Apache and IIS.
This code uses the same idea as the above, but fixes more values in _SERVER and resolves a problem with _GET. It will also work with later versions (2.8+) of Wordpress.
<?php
// This is the default file for the site. Usually index.php
$default = 'index.php';
// The name of this file.
// Set this value for the URL in Custom Error Properties of your website in IIS.
// Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
// 404 & 404;2 & 404;3 > URL (Requires a '/' prefix in IIS).
$thisfile = '404-handler.php';
$_SERVER['ORIG_PATH_TRANSLATED'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_TRANSLATED']);
$_SERVER['SCRIPT_FILENAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_FILENAME']);
$_SERVER['ORIG_PATH_INFO'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_INFO']);
$_SERVER['SCRIPT_NAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace($thisfile, $default, $_SERVER['PHP_SELF']);
$_SERVER['PATH_INFO'] = false;
$qs =& $_SERVER['QUERY_STRING'];
$ru =& $_SERVER['REQUEST_URI'];
$pos = strrpos($qs, '://');
$pos = strpos($qs, '/', $pos + 4);
$_SERVER['URL'] = $ru = substr($qs, $pos);
$qs = trim(stristr($ru, '?'), '?');
// Required for Wordpress 2.8+
$_SERVER['HTTP_X_ORIGINAL_URL'] = $ru;
// Fix GET vars
foreach ( $_GET as $var => $val ) {
if ( substr($var, 0, 3) == '404') {
if ( strstr($var, '?') ) {
$newvar = substr($var, strpos($var, '?') + 1);
$_GET[$newvar] = $val;
}
unset($_GET[$var]);
}
break;
}
include($default);
?>
