vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Add new Users (automatically) (https://vborg.vbsupport.ru/showthread.php?t=82836)

tomypro 04-10-2009 10:42 PM

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

nessur 05-04-2009 08:50 PM

Thank you, and thank you! This fixed my problem.

Quote:

Originally Posted by harty83 (Post 1676059)
Just as a FYI, the first line (global $vbulletin) is not necessary. That was overlooked on my part. The full code that got it working is

Code:

               
//load the vbulletin framework
define('VB_AREA', 'External');
define('SKIP_SESSIONCREATE', 1);
define('SKIP_USERINFO', 1);
define('CWD', 'path/to/vbulletin/forum'));

require_once(CWD . './includes/init.php');

 //work around to make global vbulletin stick
$registry = $vbulletin;
unset($vbulletin);
$vbDb = $registry->db;
//declare as global vbulletin's registry and db objects
global $vbulletin,$db;
$vbulletin = $registry;
//vbulletin db object which is needed for vbulletin's project tools addon
$db = $vbDb;

Thanks!
Alan


galt 05-12-2009 01:33 PM

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();
        };

When the second block of code executes, I get the error:

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.

php-resource.de 05-13-2009 08:54 AM

Quote:

Originally Posted by galt (Post 1809352)
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();
        };

When the second block of code executes, I get the error:

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.

I guess you are using the global $db within your CMS.
Try the following workaround:
PHP Code:

  $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;

  
/*
   * Your code here
   */

  // Restore your $db object (new!!)
  
$db $backupdb


galt 05-13-2009 09:43 AM

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.

andha513 08-05-2009 09:05 PM

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.

ringleader 09-07-2009 02:22 PM

Quote:

Originally Posted by andha513 (Post 1862164)
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?

I assume you fixed your problem by now.

If not, you have to set the usergroup id for each member:
$newuser->set('usergroupid', 2);

andha513 09-07-2009 02:45 PM

Quote:

Originally Posted by ringleader (Post 1881122)
I assume you fixed your problem by now.

If not, you have to set the usergroup id for each member:
$newuser->set('usergroupid', 2);

Thanks, but I do set the usergroup id for each member (to 2).
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.

ringleader 09-07-2009 03:01 PM

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?

andha513 09-07-2009 03:39 PM

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:

Originally Posted by ringleader (Post 1881143)
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?


mikesharp 09-14-2009 11:15 AM

Is there an update on a working version of this for 3.8.x ???

thanks all

Mike

ragtek 09-14-2009 01:16 PM

Quote:

Originally Posted by mikesharp (Post 1884512)
Is there an update on a working version of this for 3.8.x ???

thanks all

Mike

No, the code is still working

webtechuser 09-24-2009 01:30 PM

I cant login from the site page using the user wich i have created according the way described above...can somebody plz help me :(

damianzaremba4 09-27-2009 01:56 PM

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
Every time I try to run the code:
PHP Code:

function register($username$password$email){
        
define('VB_AREA''External');
        
define('SKIP_SESSIONCREATE'0);
        
define('SKIP_USERINFO'1);
        
define('CWD'$this->forum_path);
        require_once(
CWD '/includes/init.php');

        
$newuser =& datamanager_init('User'$vbulletinERRTYPE_ARRAY);
        
$newuser->set('username'$username);
        
$newuser->set('email'$email);
        
$newuser->set('password'$password);
        
$newuser->set('usergroupid'$this->forum_awaiting_confomation_group);

        if(empty(
$newuser->errors)){
            return 
$newuser->save();
        }else{
            return 
$newuser->errors;
        }


Any one got an idea why?

Thanks.

Andreas 09-30-2009 04:25 PM

Quote:

Any one got an idea why?
Yep - Variable Scope.

Booting vBulletin from non-global scope is a bit tricky.

Crimm 11-11-2009 06:37 PM

Quote:

Originally Posted by php-resource.de (Post 1809919)
I guess you are using the global $db within your CMS.
Try the following workaround:
PHP Code:

  $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;

  
/*
   * Your code here
   */

  // Restore your $db object (new!!)
  
$db $backupdb




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

yappa.be 11-27-2009 06:51 AM

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:

//load the vbulletin framework
            
define('VB_AREA''External');
            
define('SKIP_SESSIONCREATE'1);
            
define('SKIP_USERINFO'1);
            
define('CWD'PATH);

            require_once(
CWD '/includes/init.php');
        
             
//work around to make global vbulletin stick
            
$registry $vbulletin;
            unset(
$vbulletin);
            
$vbDb $registry->db;
            
//declare as global vbulletin's registry and db objects
            
global $vbulletin,$db;
            
$vbulletin $registry;
            
//vbulletin db object which is needed for vbulletin's project tools addon
            
$db $vbDb;        
            
            
$newuser =& datamanager_init('User'$vbulletinERRTYPE_ARRAY);
            
$newuser->set('username'$this->data['User']['firstname'].' '.$this->data['User']['lastname']);
            
$newuser->set('email'$this->data['User']['email']);
            
$newuser->set('password'$this->data['User']['password']);
            
$newuser->set('birthday'$this->data['User']['birthday']);
            
            
$newuser->set('usergroupid'2);  
            
            
$userfields['field11'] = $this->data['User']['optin'];
            
$userfields['field5'] = $this->data['User']['abo_nr'];
            
$userfields['field6'] = $this->data['User']['firstname'];
            
$userfields['field7'] = $this->data['User']['lastname'];
            
            
            
//userfields
            
$newuser->set_userfields($userfields);
            if(
$this->data['User']['password']!=$this->data['User']['retype_password']){
                
$newuser->errors[] = 'password_error';
            }
            
            
            if(!
$newuser->errors){
                if(
$newuserid $newuser->save()){
                                      echo 
'success';exit;
                                }
                        } 

After doing some searching, we found that the error is generated in the function build_options in includes/adminfunctions.php. This function is called in includes/class_core.php in the function check_options.

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.

Crimm 11-27-2009 07:56 PM

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 :)

bianca_roma 12-01-2009 10:09 AM

Quote:

Originally Posted by andha513 (Post 1862164)
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.

I have the same problem...Did you manage to resolve this issue? i'm desperate...

Iron Star 01-06-2010 03:27 PM

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 (Post 1912798)
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


F5-MVH 01-07-2010 04:49 PM

Using the class ForumOps (which by the way is brilliant)...... I am trying to figure out how to pass a delimited txt file of user information to it. Any help would be appreciated.

To elaborate - We have a corporate text file with the following
'user name','email address'

I need to generate new VBulletin accounts for all them.

Cheers!
Dave

lanzeym 02-03-2010 03:08 PM

Hi,

I am now able to programmatically add user by modifying script above but I have a problem when I tried to insert user from our existing database that has more than 25 character. I?m getting an error ?Username cannot be longer than 25 characters?. Can you guide me on how can I disable the maximum characters allowed for username?

I have basic knowledge in php and I look through the following included files but I can't see the function for validation the maximum length.

require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');

Anybody have done this before?

Thanks!

bigtime 02-03-2010 03:50 PM

lanzeym, sounds like you may need to make your existing database field for username larger than 25 characters.

lanzeym 02-03-2010 04:09 PM

hi bigtime!

The save() methods uses vBulletin "user" table that has varchar(100) length, so there's no need for changing field lenght. There should be a hard coded "maxlength" that I don't know where it is.

bigtime 02-03-2010 04:37 PM

Oops, I misunderstood. I thought you were inserting users into your existing database...

lanzeym 02-04-2010 04:12 PM

here's how to remove the validation.

AdminCP > vBulletin Options > User Registration Options > Maximum Username Length

Tibald 05-29-2010 01:30 PM

Anybody can help with code example for manual users registration and login for vb 4 ?

ilbianconiglio 07-13-2010 12:59 PM

I'm trying to add a new user with VB 4.0.

I'm using the latest snippet of code but when I do $newuser->save(); it saves the record to the db but return to a Database error page ( of VB ).

What can I do?

--------------- Added [DATE]1279029801[/DATE] at [TIME]1279029801[/TIME] ---------------

Ok maybe I solved.

For VB 4 you need to add this:

$newuser->pre_save();

before save() or checking errors :)

calwebsnc 07-20-2010 08:09 AM

Hi,
I am trying to do something similar.
I wrote a class inside a file in the main directory of my forum.
This is the code:
Code:

<?php

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

        class codeigniter_bridge{
               
                function codeigniter_bridge(){
                       
                        $this->usernamager =& datamanager_init('User', $vbulletin); 
                       
                }
               
                function prova(){
                       
                        return $foruminfo = fetch_foruminfo(1);
                }
        }


?>

I receive this error:
Fatal error: Call to a member function do_db_fetch() on a non-object in /var/www/cyberludus.com/system/forum/includes/init.php on line 308

Where I do wrong?
Thank you

epolitica 11-23-2010 01:32 PM

The code seems to be working, but when in debug mode a lot of notices show up. I`d rather they shouldn`t:

PHP Code:

Notice (8): Undefined index:  username [/home/path2vb/forum/includes/class_dm_user.phpline 419]
Notice (8): Undefined index:  userid [/home/path2vb/forum/includes/class_dm_user.phpline 421]
Notice (8): Undefined index:  ajax [/home/path2vb/forum/includes/functions.phpline 2696]
Notice (8): Use of undefined constant LANGUAGEID assumed 'LANGUAGEID' [/home/path2vb/forum/includes/functions_misc.phpline 795]
Notice (8): Use of undefined constant LANGUAGEID assumed 'LANGUAGEID' [/home/path2vb/forum/includes/functions_misc.phpline 812]
Notice (8): Undefined variableerrsize [/home/path2vb/forum/includes/class_dm.phpline 322]
Notice (8): Only variable references should be returned by reference [/home/path2vb/forum/includes/class_dm.phpline 294


Then I got a question, is it possibile to add an user in an inactive state, and only after a third party email validation, enable him/her? I couldn`t find any column in the vb_user table that indicates this active/inactive state, any help?

adbox 01-25-2011 02:59 PM

Looking for an updated version of this script for 4.1.1

Am getting this error:

Code:

Fatal error: Call to undefined function fetch_phrase() in /home2/hatnohat/public_html/forum/includes/functions.php on line 3456
--------------- Added [DATE]1295975525[/DATE] at [TIME]1295975525[/TIME] ---------------

This works for me.

add_user.php (custom API)

PHP Code:

<?php

function register_in_vb($username$password$email)
{
    
define('VB_AREA''External');
    
define('SKIP_SESSIONCREATE'0);
    
define('SKIP_USERINFO'1);
    
define('CWD''./../../forum/' );
    require_once(
CWD '/includes/init.php');
    require_once(
CWD '/includes/functions_misc.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'$vbulletinERRTYPE_ARRAY);
    
$newuser->set('username'$username);
    
$newuser->set('email'$email);
    
$newuser->set('password'$password);
    
$newuser->set('usergroupid'9);
    
    
$newuser->pre_save();
    
    if(empty(
$newuser->errors)){
        
$db $backupdb;
        echo 
1;
        return 
$newuser->save();
        
    }else{
        
$db $backupdb;
        echo 
0;
        
print_r$newuser->errors);
    }
        
}

$key $_GET['key'];
$username $_GET['username'];
$password $_GET['password'];
$email $_GET['email'];

if (
$key=='mysecretkey')
{
    
// Add the users to vBulletin
    
$newuserid register_in_vb($username$password$email);
}

?>


Andreas 01-26-2011 05:21 PM

Quote:

Originally Posted by adbox (Post 2154368)
Looking for an updated version of this script for 4.1.1

Am getting this error:

Code:

Fatal error: Call to undefined function fetch_phrase() in /home2/hatnohat/public_html/forum/includes/functions.php on line 3456

This is caused by a Bug that should be fixed in one of the next releases.

In the meantime you can simply add
PHP Code:

define('VB_API'false); 

to your code.

nack 08-05-2011 02:19 PM

I used this code and everything was working fine. Users got added, but when they tried to login, they got this message:
Code:

You have been banned for the following reason:
 No reason was specified.

Date the ban will be lifted: Never

I looked in the banned list. They are not in there. What could have been wrong?

ingwa 09-07-2011 07:04 PM

Nack, make sure the user group that your user is being created under is being defined. If you aren't in the right group then they show as being banned. Hope this helps.

dog199200 12-03-2011 12:03 PM

I keep getting a fatal error:Fatal error:

Code:

Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 205
I slightly modified the code above:

Main Code
Code:

<?php
mysql_connect($DBhost, $DBuser, $DBpass) or die(mysql_error());
mysql_select_db($DBname) or die(mysql_error());

$RegAllowArray = mysql_query("SELECT * FROM setting WHERE varname = 'allowregistration'") or die(mysql_error());
$RegAllow = mysql_fetch_array($RegAllowArray);

$CountUserArray = mysql_query("SELECT COUNT(*) FROM user") or die(mysql_error());
$CountUser = mysql_num_rows($CountUserArray);

if($CountUser < 50)
{
        if($RegAllow['value'] != 0)
        {
                function register_in_vb($username, $password, $email, $day, $month, $year)
                {
                        define('VB_AREA', 'External');
                        define('SKIP_SESSIONCREATE', 0);
                        define('SKIP_USERINFO', 1);
                        require_once('/home/shininga/public_html/divineshadowsonline/forum/includes/init.php');
                        require_once('/home/shininga/public_html/divineshadowsonline/forum/includes/functions_misc.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', 2);
                        $newuser->set('displaygroupid', 2);
                        $newuser->set('birthday', array($month, $day, $year));
                       
                        $newuser->pre_save();
                       
                        if(empty($newuser->errors)){
                                $db = $backupdb;
                                echo 1;       
                                return $newuser->save();
                               
                        }else{
                                $db = $backupdb;
                                echo 0;
                                print_r( $newuser->errors);
                                include("/home/shininga/public_html/divineshadowsonline/includes/register-form.php");
                        }
                }
                       
                if(!$logged_in) {
                        if(isset($_POST['username']))
                        {
                                $key = $_POST['key'];
                                $username = $_POST['username'];
                                $password = $_POST['password'];
                                $confirmpass = $_POST['confirmpass'];
                                $day = $_POST['day'];
                                $month = $_POST['month'];
                                $year = $_POST['year'];
                                $email = $_POST['email'];
                                $tos = $_POST['tos'];
                                include("/home/shininga/public_html/divineshadowsonline/includes/register-functions.php");
                                $newuserid = register_in_vb($username, $password, $email, $day, $month, $year);
                               
                        } else if(!isset($_POST['username'])) {
                                include("/home/shininga/public_html/divineshadowsonline/includes/register-form.php");
                        }
                } else {
                        echo "<h4><center><b>You are already logged in!</b></center></h4>";
                }
        } else {
                echo "<center>Registration Are Currently Disabled</center>";
        }
} else {
        echo "<center>Registration Are Currently Disabled</center>";
}
mysql_close();
?>

I could really use some help please. :P

adbox 12-06-2011 03:50 PM

Maybe this resource is related?

https://vborg.vbsupport.ru/showthread.php?t=267099

dog199200 12-06-2011 06:19 PM

Quote:

Originally Posted by adbox (Post 2275189)

They seem to be, but it doesn't exactly answer the question. I noticed i only get the error because of my header which i need:

Code:

ob_start();
$curdir = getcwd ();
chdir('/home/shininga/public_html/divineshadowsonline/forum/');
require_once('./global.php'); 

$phrasegroups = array();
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);


chdir ($curdir);

I have that added to the top of every single page because i've build my own api system for my main website around it.

adbox 12-06-2011 06:28 PM

What if you change your header to this:

Code:


require_once('/home/shininga/public_html/divineshadowsonline/forum/'); 

$phrasegroups = array();
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

I'm not certain the change directory commands are necessary.

dog199200 12-06-2011 06:34 PM

Doesn't work. I had to change the directory before because I had to call a lot of the internal features within vB. I'm pulling user information and login checks of all types all over the site. If i just include the global instead of redefining the directory I get this error:

Code:

Warning: require_once(./includes/class_bootstrap.php) [function.require-once]: failed to open stream: No such file or directory in /home/shininga/public_html/divineshadowsonline/forum/global.php on line 15

Fatal error: require_once() [function.require]: Failed opening required './includes/class_bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/shininga/public_html/divineshadowsonline/forum/global.php on line 15

Edit: Basically without the header being as how i had it, my whole site would break.

dilios 08-25-2014 07:47 PM

Vbulletin 4.x user registration version:
Code:

define('THIS_SCRIPT', 'reguser.php');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
 
$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$pass1 = $_REQUEST["pw1"];
$pass2 = $_REQUEST["pw2"];
if ($pass1 == $pass2)
        $passwd = $pass1;
else
        exit;
$userdm->set('username', $_REQUEST["user"]);
$userdm->set('email', $_REQUEST["email"]);
$userdm->set('password', $passwd);
$userdm->set('usergroupid',2);
 
#If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
if (count($userdm->errors))
{
        echo "<pre>";
        var_dump($userdm->errors);
        echo "</pre>";
} else {
        # If everything is OK
        $newuserid = $userdm->save();
        echo $newuserid."<br>Done.";
}



All times are GMT. The time now is 02:42 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01801 seconds
  • Memory Usage 2,002KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (20)bbcode_code_printable
  • (1)bbcode_html_printable
  • (7)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete