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. |
#102
|
|||
|
|||
I know this question was asked earlier, but it was never answered.
Is there any way to handle the case where the password you have is an md5 hash? I don't like sending passwords in the clear, so my login pages do the md5 hash before sending up to the server, so I don't have access to the actual password. Any ideas? --------------- Added [DATE]1213414760[/DATE] at [TIME]1213414760[/TIME] --------------- OK, I've managed to answer my own question. It turns out that you can use md5's also. If you pass in a plain-text, it will md5 it. But if you pass in an md5, it will use it as-is (basically it just checks to see if the password is 32 characters long - if it is, it assumes it's an md5). So it "just works". Cool! :up: |
#103
|
|||
|
|||
I don't know if this has been covered yet but if you would like to show the username and userid in your activation mail you just have to set $username and $userid to the appropriate values.
|
#104
|
|||
|
|||
Quote:
Thanks. But, when you do $userdm->save, won't the user is automatically activated? I assume that you used the code in https://vborg.vbsupport.ru/showpost....&postcount=31; --------------- Added [DATE]1215493772[/DATE] at [TIME]1215493772[/TIME] --------------- All right. This entire integration thing works partially for me. After getting frustrated, I wrote the program to get the user data from the form and update the Vbulletin tables directly. Here is the logical flow: 1. I updated user and useractivation tables with the user information. I set the usergroupid as "3" (users waiting for email activation group) in user table and added the row for the new user in useractivation table. This row will be deleted when the user activates the account. 2. I sent the activation email to the user. This is a nice thing, because I can customize the email format. If a user registers in the main site and the forum sends the activation email, it looks kind of weird. Because some users of our CMS site don't even know what is a forum. 3. User clicks the link in the activation email. Program checks the activation id in the useractivation table. If everything is ok, the usergroupid is changed from 3 to 2 in usertable. Activation record in useractivation table is deleted, because it's no longer needed. Ok. All works well. The user can do anything he wants just as he would normally do when he registers using forums/register.php. But..(you know it's coming!) there is a headache for the admin. In the admin control panel, username, email, IP, and all those fields are EMPTY for this user. Options like receive admin email, PM options, etc., are all set ok. Only the username, email, IP fields are empty. Do I need to update another table? Doesn't admin control panel use the user table to display the user profile? |
#105
|
|||||||
|
|||||||
Personally I got very odd:"Existing data passed is not an array" while using amatulic's class and when doing:
Quote:
--------------- Added [DATE]1215718968[/DATE] at [TIME]1215718968[/TIME] --------------- Quote:
--------------- Added [DATE]1215719381[/DATE] at [TIME]1215719381[/TIME] --------------- This doesn't help: Quote:
ok. for some unknown reason in the userdata_convert function exist the following line: Quote:
Quote:
As I've figured out, there is some problem with login part, cause as soon as I turned it off, I was able to register user in vBulletin. At least it has showed up in the database. --------------- Added [DATE]1215760677[/DATE] at [TIME]1215760677[/TIME] --------------- It is "function fetch_userinfo_from_username" that does the trouble. It is not able to retrieve the information from database with its: Quote:
--------------- Added [DATE]1215769463[/DATE] at [TIME]1215769463[/TIME] --------------- ok. for some reason $login variable is set to true in register_newuser so that it tries to login user by default as soon as he/she is registered. However it seems that user is not inserted in database yet, when the function tries to login him/her. I don't know why, but that's what happens. So I've turned $login to false, like this: Quote:
PHP Code:
|
#106
|
|||
|
|||
Is there any chance that this'll work, cross site? I'd added a forum on a different server to my main site and I wanted to sync the signups so when someone signs up on my main site it signs them up on the forum.
Any advice?? Regards, Jonaid |
#107
|
|||
|
|||
You can use cURL php extension, however I do not know whether it is active by default. With cURL you can call any remote php script and pass parameters to it through the ordinary POST, just like you do it from HTML form.
|
#108
|
|||
|
|||
Hi,
I'm using amatulic's code in an attempt to create a new user but I keep on getting this error even when using the example test code for making a new user. Any ideas? Fatal error: Existing data passed is not an array Called set_existing in /var/www/vhosts/carrington-club-international.co.uk/httpdocs/include/class.forumops.php on line 296 Called login in /var/www/vhosts/carrington-club-international.co.uk/httpdocs/include/class.forumops.php on line 153 Called register_newuser in /var/www/vhosts/carrington-club-international.co.uk/httpdocs/testforumreg.php on line 14 in [path]/includes/class_dm.php on line 235 Thanks Pete |
#109
|
|||
|
|||
Hi threre,
I've got some trouble running the PHP code from the first post. To be honest - I'm not so familiar with PHP It would be great if anybody could have a look into this ... (I already posted this issue in the german board http://www.vbulletin-germany.com/for...ad.php?t=38534 and was advised to ask the author of the code ) Below you'll find the (entire) code which I use in a PHP file (called createuser.php). I started the code by entering http://www.xyz.de/_forum/createuser.php in the URL-field of my browser. Code:
<?php define('VB_AREA', 'External'); define('SKIP_SESSIONCREATE', 1); define('SKIP_USERINFO', 1); define('CWD', '.'); require_once(CWD . '/includes/init.php'); $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); $newuser->set('username', 'selter'); $newuser->set('email', 'selter@xyz.de'); $newuser->set('password', 'geheim'); $newuser->set('usergroupid', 2); $newuserid = $newuser->save(); ?> Unfortunately I got this error message: Quote:
Where is the bug??? Thanks Selter |
#110
|
||||
|
||||
init.php
PHP Code:
|
#111
|
|||
|
|||
Quote:
Code:
Fatal error: Call to a member function query_first() on a non-object in /home/jfusiono/public_html/demo/vbulletin/includes/functions_databuild.php on line 1684 Code:
//load the vbulletin framework define('VB_AREA', 'External'); define('SKIP_SESSIONCREATE', 1); define('SKIP_USERINFO', 1); define('CWD', $params->get('source_path')); global $vbulletin; require_once(CWD . '/includes/init.php'); //setup the new user $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); $newuser->set('username', $userinfo->username); $newuser->set('email', $userinfo->email); $newuser->set('password', $userinfo->password_clear); $newuser->set('usergroupid', $usergroup); $newuser->set('password', $userinfo->password_clear); $newuserid = $newuser->save(); This is the final hurdle before releasing a Beta version of JFusion, a revolutionary Joomla universal bridge. Any help would be greatly appreciated. Thanks, Marius |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|