Hi,
I am trying to delete VB user via one of my php scripts, using the following code:
Code:
function qpc_post($varname)
{
return trim(stripslashes((get_magic_quotes_gpc()) ? $_POST[$varname] : addslashes($_POST[$varname])));
}
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
/* get user id of specifed username */
$array = $db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username='" . qpc_post('username') . "'");
$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$userdm->set_existing(fetch_userinfo($array['userid']));
$userdm->delete();
As you can see the username of the user to be deleted is posted to this script using CURL, then I get the userID of that user and create a new user datamanager to store the details for this user. Then I set the userdm to hold the details of this existing user using fetch_userinfo.
Then to delete the user I simply call the delete() method. This code deletes the user as when i check in the admin cp the user account has gone however I still get the following error (deleteVBUser.php my php script):
Fatal error: Existing data passed is not an array
Called set_existing in /usr/local/apache/htdocs/forums/deleteVBUser.php on line 22
in /includes/class_dm.php on line 235
Any ideas on what this means? Am I doing something wrong?
Your help would be much appreciated.
Thanks