The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Add new Users (automatically)
As this is a common request for integration purposes, I thought I should write up another HowTo If you want to add a new user to the vBulletin database, you can use Class vB_Datamanager_User. This Calss does make sure that everything is OK, it will also take care of the default registration options. Example PHP Code:
PHP Code:
If everything is OK PHP Code:
You can also set many other info too:
Besides that, you can also set the options Bitfield (Receive Admin PMs, etc.) PHP Code:
Value must be 0 or 1 (false or true), depending if you want to set the option or not. If the Options are not set, the Default Registration Options/Board Default Options will be used. Important Notice It is assumed that you are using this code from 'within' vBulletin, eg with the vBulletin backend loaded. If this is not the case, you must include smth. like the following code in global context: PHP Code:
This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent. |
#122
|
|||
|
|||
Hi,
Im using ArbuZz's code base and its working create; i am using it as well as a SSO bridge between my app and the integrated vbulletin board. Once thing i would like to achieve is that as soon as I trigger the login call for a user through my busines logic not only the session cookie is set but that that partiular users appears as online within vbulletin as well. Is this something that can be achieved through the Data API as well? //Thomas |
#123
|
|||
|
|||
Thank you, and thank you! This fixed my problem.
Quote:
|
#124
|
|||
|
|||
After hours of hacking at this, I am once again stuck. I have included this code in my CMS.
Code:
if ($vbswitch == 'Y') { chdir('./forums'); define('THIS_SCRIPT','pg_usermgmt2.php'); // define('VB_AREA', 'Forum'); require_once("global.php"); require_once("./includes/class_dm.php"); require_once("./includes/class_dm_user.php"); chdir('../'); }; and lower down Code:
if ($vbswitch == 'Y') {
$newuser = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
// $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $UserName);
$newuser->set('email', $EMail);
$newuser->set('password', $Password);
$newuser->set('usergroupid', 2);
if ($newuser->errors) {
echo $newuser->errors;
}
else {
$newuserid = $newuser->save();
};
Database object is not an object in [path]/includes/class_dm.php on line 172 I am stumped. I tried adding the global hack referenced a few posts back, and it did nothing for me. I am spending more time trying to get VB rgistration integrated that I am writing my entire CMS!!! ARRRGGGHHH !!!!! I would gladly pay someone to do this for me if I could find them. ********************************** Nevermind. I just wrote my own object. WAY faster and easier. |
#125
|
||||
|
||||
Quote:
Try the following workaround: PHP Code:
|
#126
|
|||
|
|||
Thanks. I had already tried that, then removed it. That was my reference to "the global hack referenced a few posts back". It did not help. At this point I am creating a new user and maintaining critical fields managed with some SQL directly into the vB database. As soon as I figure out cookies and login, I am good to go. That is, until vB changes the user scheme, at which time i will have an ongoing maintenance nightmare. OTOH it took me 2-3 hours to figure out and write the custom code from scratch, and I spent many more hours than that (and got more frustrated) trying to research and utilize the VB object library.
Added ----- After more review, I see that you added lines relating to $backupdb. That may have done the trick, but dealing with vB and its programming philosophy is just a nightmare, and I am too close to done to go backwards again. Thanks for your effort though. |
#127
|
|||
|
|||
I am porting all my users from a social networking site (Drupal CMS) to our new vBulletin forum, but having a small issue.
Since all Drupal passwords are already MD5'ed, I am simply creating vBulletin users manually by connecting to the vBulletin database and inserting the appropriate data into the user-table, the userfield-table and the usertextfield-table. (Since this is what I gather from the vBulletin registration script) The users are created fine and working well, except that all users created with my script get the "Guest" title in their forum posts. And I just can't figure out why. There are no users in the unregistered/guest usergroup (where people are assigned the "Guest" title), so that's not it. We have no "Guest" user title in the User Title Manager, so that's not it either. I'm assuming I'm missing to add some data to some table for each user. Would someone here be able to offer some help? Thanks in advance. |
#128
|
||||
|
||||
Quote:
If not, you have to set the usergroup id for each member: $newuser->set('usergroupid', 2); |
#129
|
|||
|
|||
Quote:
Problem not really solved, but vBulletin's own "fix broken user profiles" feature does correct the user profiles, and I'm ok with this for now. |
#130
|
||||
|
||||
usergroupid=2 is normally the default setting for the 'registered users' group.
Go to http://www.YourForumAddressHere.com/....php?do=modify and use whichever number for the usergroupid that you want to set for each member you're importing. The usergroupid sets the permissions that you want the user to have on the forums. Is that clearer for you? |
#131
|
|||
|
|||
I appreciate the effort, but I am aware of all this. Unless there is another database table related to the usergroups, the usergroups do not seem to be the problem here.
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|