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)

dwh 06-29-2005 11:03 PM

Quote:

Originally Posted by KirbyDE
You would have t hook into register_activate_process and change the Usergroupid there.

Anyway, the described method does not generate an activation ID and such.
If you are interested in this I can write up some description.

I will be using the activation ID eventually and it would be very helpful. But I'm in no urgent rush at all for this.

Xia 07-02-2005 10:38 AM

What files need to be included to get this to work?

I don't see the function datamanager_init in class_dm_user.php

Thanks

tema 07-12-2005 09:51 AM

Quote:

Originally Posted by KirbyDE
Anyway, the described method does not generate an activation ID and such.
If you are interested in this I can write up some description.

Ok, can u describe how to make user whith waiting for activation with emailing of that?

merk 07-12-2005 11:41 PM

Quote:

Originally Posted by MarcoH64
Please read the stickied post in the top of this forum.

I cant imagine that this falls under the "dont ask questions". This question was specific to this howto about improving it with the format of a mentioned error variable.

scott8539 10-28-2005 07:45 PM

Quote:

Originally Posted by Andreas
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:

$newuser =& datamanager_init('User'$vbulletinERRTYPE_ARRAY);
$newuser->set('username''phpNukeUser');
$newuser->set('email''foo@bar.com');
$newuser->set('password''verysecret');
$newuser->set('usergroupid'2); 

.....


Perhaps I am missing something...but I cannot get the above code to work. Could you provide a complete, self contained script that can be executed on the cmd line (or exec'd or remote require'd from another program)? I have searched through this forum and found examples of creating a thread , but this is the only code reference to creating a user --- which is exactly what I am after!

My goal in this is to have my own CMS manage the registration: The user will register in my CMS (custom designed CMS -- this is not a 3rd party off-the-shelf CMS), then call a script to add the user to the forum.

Thanks!

-Scott
vB 3.5

J75595E3F40B 11-03-2005 07:46 PM

yes I also cannot get the script above to work.. do I need to initialize $vbulletin via a constructor?

akanevsky 11-03-2005 08:07 PM

Quote:

yes I also cannot get the script above to work.. do I need to initialize $vbulletin via a constructor?
The script works as long as you use it on a vbulletin-powered page.

J75595E3F40B 11-03-2005 08:22 PM

What would be necessary to use the user data-manager from outside a vbulletin-powered page?

Andreas 11-03-2005 09:11 PM

The vBulletin backend, which makes it a vBulletin powered page :)

scott8539 11-03-2005 09:46 PM

I finally got a working script to add a user to vB offline. I maintain a separate Membership System. When a user registers in this separate system, an account is automatically created for them in vB.

When they register (again, this is in my own Member System -- on a different domain), I collect those variables that I need specifically (and minimally) to create an account in vB.

I then cURL those variables to a custom script (called bb_add_user.php) which resides in the root folder of the forum. The results of bb_add_user.php are printed, which are then collected in the result of the cURL. If there are errors, the Membership System takes appropriate action. If successul, then I grab the vbuserid from the cURL result and go about my business.

Although I am still proving this system on a development server, my goal will be to change all of the 'register.php' links on vBulletin and point them to the register script on my Membership System.

Here is the bb_add_user.php code.

Code:

<?php
        # Add a user to vBulletin (offline)
               
        function qpc_post($varname)
        {
                return trim(stripslashes((get_magic_quotes_gpc()) ? $_POST[$varname] : addslashes($_POST[$varname])));
        }

        define('THIS_SCRIPT', 'bb_add_user.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);
       
        $userdm->set('username', qpc_post('username'));
        $userdm->set('email', qpc_post('email'));
        $userdm->set('password', qpc_post('password'));
        $userdm->set('usergroupid', 2);
        $userdm->set('ipaddress', qpc_post('ipaddress'));
        $userdm->set('referrerid', qpc_post('referrername'));
        $userdm->set('timezoneoffset', qpc_post('timezoneoffset'));
        $userdm->set_bitfield('options', 'adminemail', intval(qpc_post('adminemail')));
        $userdm->set_bitfield('options', 'showemail', intval(qpc_post('showemail')));
       
        $dst_setting = intval(qpc_post('dst'));
        switch ($dst_setting)
        {
                case 0:
                case 1:
                        $userdm->set_bitfield('options', 'dstonoff', $dst_setting);
                        break;
                case 2:
                        $userdm->set_bitfield('options', 'dstauto', 1);
                        break;
        }
       
        #If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
        if (count($userdm->errors)) {
                for($i=0; $i<count($userdm->errors); $i++) {
                        print "ERROR{$i}:{$userdm->errors[$i]}\n";
                }
        } else {
                # If everything is OK
                $newuserid = $userdm->save();
                print "vbuserid:$newuserid\n";
        }
       

?>



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

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01213 seconds
  • Memory Usage 1,755KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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