I ended up figuring this out a while ago… completely forgot to post it here.
Once I added the include properly it worked:
require_once('./wp-admin/includes/ms.php');
if ( $user ) {
wpmu_delete_user( $user->ID );
}
For the sake of future readers here was the final code:
function handle_gateway_return() {
$GWPass = get_option( $this->gateway . "_gateway_gwpass" );
if ($_GET["GWPass"] != $GWPass) {
header("HTTP/1.0 401 Unauthorized");
echo "<h1>Gateway 1.1</h1><h3>Authentication failed.</h3>";
exit;
}
if ($_GET["Action"] == "user.add") {
// Load variables.
$ZFirstName = trim($_GET['FIRSTNAME']);
$ZLastName = trim($_GET['LASTNAME']);
$ZFullName = $ZFirstName." ".$ZLastName;
$ZUserName = trim($_GET['username']);
$ZEmail = trim($_GET['EMAIL']);
$ZPassword = trim($_GET['password']);
$ZPassword = md5($ZPassword); //md5
if ( !username_exists( $ZUserName ) ) {
wp_create_user( $ZUserName, $ZPassword, $ZEmail );
}
// Tell server that user was added
echo "OK|User added!";
exit;
}
else if ($_GET["Action"] == "user.delete") {
$ZUserName = trim($_GET['username']);
$user = get_user_by( 'login', $ZUserName );
require_once('./wp-admin/includes/ms.php');
if ( $user ) {
wpmu_delete_user( $user->ID );
} else {
echo "User Not Deleted!";
exit;
}
// Tell server user deleted
echo "OK|User deleted!";
exit;
}
else {
echo "UNKNOW_ACTION|UNKNOW_ACTION";
exit;
}
}