
01-06-2010, 03:27 PM
|
 |
|
|
Join Date: Jul 2008
Location: France
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
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:
Originally Posted by Crimm
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;
}
}
and I called it on wp-login.php in the register_new_user function. I added it right after the User Password Generation so I could pass it to vB.
Code:
// Add the users to vBulletin
$newuserid = register_in_vb($user_login, $user_pass, $user_email);
That should help some people if you come across this :P
|
|