buy
Delete User

Description

Use the Delete User API to delete a user present on your server, by passing the user name of the user. The API response consists of "done" parameter which is "User Deleted Successfully" if the user is deleted successfully.

Parameters

Sample Code

curl -ku "user:password" "https://hostip:2005/index.php?api=json&act=users&delete_user=user1,user2&del_sub_acc=1&skip_reseller=1"
<?php
$user = 'your_user';
$pass = 'your_password';
$ip = 'your_ip';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2005/index.php?api=json&act=users'; 

$post = array('delete_user' => 'user1', 'del_sub_acc' => '1', 'skip_reseller' => '1');


// Set the curl parameters 
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

if(!empty($post)){
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}

// Get response from the server. 
$resp = curl_exec($ch);

// The response will hold a string as per the API response method. In this case its PHP JSON
$res = json_decode($resp, true);

// Done ?
if(!empty($res['done'])){
	echo 'User deleted successfully';
	print_r($res['done']);
// Error
}else{
	echo 'Some error occurred';
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'your_user';
$pass = 'your_password';
$host = 'your_ip';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$username = 'user1,user2';
$del_sub_acc = 1;
$skip_reseller = 0;
$res = $webuzo->delete_user($username, $del_sub_acc, $skip_reseller);

// Done/Error
if(!empty($res['error'])){
	echo 'Error while performing action : ';
}else{
	echo 'User deleted successfully.';
	print_r(json_decode($res, true));
}
?>

Output

User deleted successfully
Array ( [actid] => 16726 [msg] => Selected user(s) are being deleted in background. Click here to view the logs )
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list