The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Deleting Users via the Data manager
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(); 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 |
#2
|
|||
|
|||
take a look at the user dm class ill get back to you about this in one sec i just need to find a hack file.
PHP Code:
|
#3
|
|||
|
|||
Hi,
Thanks for the quick response. I have modified my code so that it matches the your example but I am still getting the same error: Fatal error: Existing data passed is not an array Called set_existing in /usr/local/apache/htdocs/forums/deleteVBUser.php on line 23 in /includes/class_dm.php on line 235 Can the delete method be called in the manner which I am trying? Or Is it because I am using the function fetch_userinfo to set the existing contents of a user data manager? Thanks Hi I think the error I am getting relates to the following code, which can be found in includes/class_dm_user.php (line 1795): Code:
$admindm =& datamanager_init('Admin', $this->registry, ERRTYPE_SILENT); $admindm->set_existing($this->existing); $admindm->delete(); unset($admindm); In the above code it seems to initiate a admin datamanager and then tries to delete it, is this right? I am trying to delete users who may not have logged into the forums, is this possible? Or can you only delete users who have logged in? Thanks |
#4
|
|||
|
|||
you might need to add this in require_once(DIR . '/includes/adminfunctions.php');
|
#5
|
|||
|
|||
Hi,
Again thanks for the quick response! added the following include : require_once(DIR . '/includes/adminfunctions.php'); But I still get the same error. The really strange thing is that it deletes the user but still displays the error message. As I said in my previous post it seems initialise an admin datamanager, I dont understand why it does this!? Thanks |
#6
|
|||
|
|||
i just found this // Do the account deletion
$info = fetch_userinfo($vbulletin->GPC['userid']); also use unset($userdm); after the first code i gave you |
#7
|
|||
|
|||
Hi,
Nope that didnt work still get the same error message! Regarding the code that you listed in your last post am I correct in assuming that it would only delete the user account of the user who is currently logged in? Basically I need my script to be able to delete any user based on the username that is supplied to the script (via POST/CURL), is this even possible? Like I said it seems to work but I still get the annoying error message! Thanks |
#8
|
||||
|
||||
Remove please!
|
#9
|
|||
|
|||
Ever find the solution for this?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|