TJFweb
12-18-2008, 03:46 AM
Hi,
Alright, I finally have a script working which will insert users into my vBulletin installation when POSTed to. See the following:
<?php
ob_start();
define('THIS_SCRIPT', 'add_user.php');
chdir('C:\path\to\httpdocs');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$usergroupid = $_POST['usergroupid'];
$timezoneoffset = $_POST['timezoneoffset'];
$key = $_POST['key'];
$valid_key = md5($username . iwca_astound_world_success_88_1973);
#if ($key != $valid_key) {
#exit("Incorrect Key");
#}
$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$userdm->set('username', $username);
$userdm->set('email', $email);
$userdm->set('password', $password);
$userdm->set('usergroupid',$usergroupid);
$userdm->set('ipaddress', $ipaddress);
$userdm->set('timezoneoffset', $timezoneoffset);
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');
#If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
if (count($userdm->errors)) {
for($i=0; $i<count($userdm->errors); $i++) {
print "ERROR{$i}:{$userdm->errors[$i]}\n";
}
} else {
# If everything is OK
$newuserid = $userdm->save();
echo "Account created!"; }
chdir('C:\path\to\httpdocs');
ob_end_flush();
?>
Now my question is - how can I modify this script to allow user profile fields to be set too?
According to this post (https://vborg.vbsupport.ru/showpost.php?p=1443761&postcount=6), the data manager can't set custom fields. He did however provide code, which unfortunately I don't quite understand. Could someone please tell me how I could insert this code into my add_user.php script to set user profile fields after creating their account with the data manager?
Thanks a lot in advance!
Alright, I finally have a script working which will insert users into my vBulletin installation when POSTed to. See the following:
<?php
ob_start();
define('THIS_SCRIPT', 'add_user.php');
chdir('C:\path\to\httpdocs');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$usergroupid = $_POST['usergroupid'];
$timezoneoffset = $_POST['timezoneoffset'];
$key = $_POST['key'];
$valid_key = md5($username . iwca_astound_world_success_88_1973);
#if ($key != $valid_key) {
#exit("Incorrect Key");
#}
$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$userdm->set('username', $username);
$userdm->set('email', $email);
$userdm->set('password', $password);
$userdm->set('usergroupid',$usergroupid);
$userdm->set('ipaddress', $ipaddress);
$userdm->set('timezoneoffset', $timezoneoffset);
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');
#If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
if (count($userdm->errors)) {
for($i=0; $i<count($userdm->errors); $i++) {
print "ERROR{$i}:{$userdm->errors[$i]}\n";
}
} else {
# If everything is OK
$newuserid = $userdm->save();
echo "Account created!"; }
chdir('C:\path\to\httpdocs');
ob_end_flush();
?>
Now my question is - how can I modify this script to allow user profile fields to be set too?
According to this post (https://vborg.vbsupport.ru/showpost.php?p=1443761&postcount=6), the data manager can't set custom fields. He did however provide code, which unfortunately I don't quite understand. Could someone please tell me how I could insert this code into my add_user.php script to set user profile fields after creating their account with the data manager?
Thanks a lot in advance!