WordPress Multisite- Quick Delete to Reuse Email

Wordpress Schwag Image thanks to Armando.

In WordPress Multisite, a user can sign up under an email address. They then decide to delete their account for some odd reason. If they try to sign up again under that same email, it’ll say the email address is being used and will become available in a few days. In a situation like ours (all accounts are restricted to VCU email addresses) that’s a problem.

You can jump right into phpMyAdmin and delete the row that contains this information in the wp_signups table. That’s no big deal unless you have a giant database and then using phpMyAdmin1 is a very special kind of slow motion misery.

The following two piece solution allows me to just go to a website, enter the email address I wish to expunge and presto change-o the email is available to be used again.

This isn’t rocket science (but it may be helpful) and there may be alternate paths. Those who know better, feel free to warn and/or educate me.

Piece 1

A little tiny HTML form.

<form action="deduplicate.php" method="post">
        	//form action above links to whatever you've named your php file
	Email to destroy: <input type="text" name="killuser" /><br />
	<input type="submit" name="submit" value="Submit me!" />

Piece 2

if(isset($_POST['submit'])) {
// sql to delete a record that matches the variable (killuser) from the web form
$sql = "DELETE FROM wp_signups WHERE user_email LIKE '$killuser'";

//then the confirmation or non-confirmation message
if ($conn->query($sql) === TRUE) {
	echo "Zombie Destroyed. Go in peace.";
} else {
	echo "You cannot kill me! Error deleting record: " . $conn->error;

1 It’s likely someone with more skills would just use the command line to knock all this out but I’m not there yet. I’m working on it.