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. |
#132
|
|||
|
|||
Is there an update on a working version of this for 3.8.x ???
thanks all Mike |
#133
|
|||
|
|||
No, the code is still working
|
#134
|
|||
|
|||
I cant login from the site page using the user wich i have created according the way described above...can somebody plz help me
|
#135
|
|||
|
|||
I get the error
Code:
Fatal error: Call to a member function query_read_slave() on a non-object in /var/www/test_forums/includes/functions_misc.php on line 789 PHP Code:
Thanks. |
#136
|
||||
|
||||
Quote:
Booting vBulletin from non-global scope is a bit tricky. |
#137
|
||||
|
||||
Quote:
I just wanted to say that I was implementing this article with Wordpress and kept getting errors about functions_databuild.php on line 1685. So I added "global $vbulletin" and started having the issue of class_dm.php on line 177 about Registry Object. The above code worked for me. So here's my function (A combination of those in this article for wordpress) Code:
// Function for vB registration // function register_in_vb($username, $password, $email){ define('VB_AREA', 'External'); define('SKIP_SESSIONCREATE', 0); define('SKIP_USERINFO', 1); define('CWD', 'ABSOLUTE_VB_PATH' ); require_once(CWD . '/includes/init.php'); $registry = $vbulletin; unset($vbulletin); $vbDb = $registry->db; //declare as global vbulletin's registry and db objects global $vbulletin,$db; $vbulletin = $registry; //backup the original $db object (new!!) $backupdb = $db; $db = $vbDb; $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); $newuser->set('username', $username); $newuser->set('email', $email); $newuser->set('password', $password); $newuser->set('usergroupid', 3); if(empty($newuser->errors)){ $db = $backupdb; return $newuser->save(); }else{ $db = $backupdb; return $newuser->errors; } } Code:
// Add the users to vBulletin $newuserid = register_in_vb($user_login, $user_pass, $user_email); |
#138
|
|||
|
|||
Hello,
A few weeks ago, we launched a website with a custom registration in stead of register.php to add new users. With the help of this forum, we succeeded without any problems. Since last monday, the register was down. The php-code did not change so we have no clue what so ever what could be the problem. Error code: HTML Code:
<b>Fatal error</b>: Call to a member function query_read() on a non-object in <b>/var/www/html/forum/includes/adminfunctions.php</b> on line <b>2403</b><br /> PHP Code:
Does anybody have an idea what could be the problem. It seems that because of some changes in the settings (or something like that), we lost our database-object but didn't change anything to the code itself. |
#139
|
||||
|
||||
I just happen to pass by here looking for something else and I saw your response.
Did you add a profile field, maybe? Just a thought. If you get it figured out, please post the solution |
#140
|
|||
|
|||
Quote:
|
#141
|
||||
|
||||
Unfortunately, I obtain this:
Fatal error: Call to a member function do_db_fetch() on a non-object in vb_forum/includes/init.php on line 308 An idea? Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|