phoenixlaef
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Networking WordPress
In reply to: Deleting a user with wpmu_delete_userjkhongusc thanks heaps for your help!
This is my first attempt at writing php let alone for wordpress, so i really appreciate your input.
Using function_exists I was able to troubleshoot and yes you were right… once I added:
require_once('./wp-admin/includes/ms.php'); if ( $user ) { wpmu_delete_user( $user->ID ); }The user was FINALLY deleted!
So 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; } //================================================== // Action: user.add //================================================== 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; } //================================================== // Action: user.delete //================================================== 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; } //================================================== // Action: UNKNOWN //================================================== else { echo "UNKNOW_ACTION|UNKNOW_ACTION"; exit; } }
Viewing 1 replies (of 1 total)