View Full Version : Add User Script in PHP
Peter Kes
05-08-2014, 10:41 AM
Hello,
Can someone guide me how to write a PHP script (for vBulletin 4.2.2) that adds a user.
No verification of user required, just add the user.
Thanks for your help,
Peter
Lynne
05-08-2014, 05:17 PM
Did you check the articles forum? There is an article somewhere in there on adding users.
tbworld
05-08-2014, 08:30 PM
This should get you started. :)
As @Lynne suggested you should search yourself for a more comprehensive search.
http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/381060-using-api-to-create-a-user-from-a-remote-location
https://vborg.vbsupport.ru/showthread.php?t=82836
Peter Kes
05-09-2014, 07:27 AM
Thank you Lynne and tbworld. I did see thread 82836, but was unable to run it successfully. SInce it was an old thread and I am running 4.2.2 I raised this again.
It did succeed now: I placed this script in the root directory of my vbulletin tree and it now did run, both from a url call as well as from the command line. Thanks for your patience and help.
Peter
<?php
define('VB_AREA', 'External');
define('SKIP_SESSIONCREATE', 1);
define('SKIP_USERINFO', 1);
define('CWD', '/pathtomyvbulletin');
require_once(CWD . '/includes/init.php');
$newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', 'Auto User');
$newuser->set('email', 'myuser@email.com');
$newuser->set('password', 'verysecret');
$newuser->set('usergroupid', 2);
$newuserid = $newuser->save();
?>
Lynne
05-09-2014, 04:44 PM
Did you go to the very last page of the thread to see users posting scripts that work with vB4.x?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.