vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=82836

Add new Users (automatically)
by Andreas
10 Jun 2005 16:11

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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This is an array containing the errors.

If everything is OK

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This will create a new User called phpNukeNuser (UserID returned in $newuserid).

You can also set many other info too:
  • membergroupids = comma-separated string of all additional usergroups (Default=Empty)
  • displaygroupid = ID of the usergroup this user should show up as (Default=0)
    Note that this must be set after usergroupid and membergroupids!
  • styleid = ID of the Style to be used by this user (Default=Board Default)
  • languageid = ID of the language to be used by this user (Default=Board Default)
  • threadedmode = Whether to use Flat (0), Hybrid (1) or Threaded (2) Display Mode
  • maxposts = Integer, how many posts should be shown on one Page (Default=Board Default)
  • ipaddress = String, IP-Adress of the User registering (Default=Empty)
  • refererid = String, Username or UserID of the User this user was refered by
  • parentemail = String. eMail-Address of the users Parents
  • daysprune = Integer, show threads from the last X days
  • startofweek = Integer, When does the week start (1=Sunday, 2=;onday, ...) (Default=Board Default)
  • timezoneoffset = Integer, spexifying the Timezone (-12 .. +12)
  • autosubscribe = Integer, defining default mode for Thread subscription
    -1 = no Subscription, 1 = Instant, 2 = Daily Digest, 3 = Weekly Digest
    (Default=Board Default)
  • homepage = String, URL of the users Homepage (Default=Empty)
  • icq = String, the Users ICQ # (Default=Empty)
  • aim = String, the Users AIM ID (Default=Empty)
  • yahoo = String, the Users Yahoo ID (Default=Empty)
  • MSN = String, the Users MSN ID (Default=Empty)
  • usertitle = String, the Usertitle this user should have
  • customtitle = Integer, defining behaviour of Usertitle. 0=No Custom Title, 1=Custom, Title with HTML, 2=Custom Title without HTML (Default=
  • birthday = array(month, day, year). The users birthdate.
  • avatarid = Integer, ID of the Avatar being used for this user
  • signature = String. The Users Signature
  • subfolders = Array. The Users Subscription Folders
  • pmfolders = Array. The Users Subscription Folders
  • buddylist = String. Space separated List of UserIDs defining the Users buddylist
  • ignorelist = String. Space separated List of UserIDs defining the Users ignorelist

Besides that, you can also set the options Bitfield (Receive Admin PMs, etc.)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The available Options are
  • showsignatures = Show Signatures
  • showavatars = Show Avatars
  • showimages = Show Images, incl. attached Images and [img] BBCode
    If this is not set they will show up as links
  • coppauser = User is COPPA User
  • adminemail = Receive Admin eMails
  • showvcard = Allow vCard Download
  • dstauto = Automatically detect DST setting
  • dstonoff = DST turned On
  • showemail = Receive eMails from other Users
  • invisible = Be invisible
  • showreputation = Show Reputation
  • receivepm = PM turned on
  • emailonpm = eMail notification for new PMs

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Keep in mind that if you are using the a/m Datamanager-Code within a function or method you must global $vbulletin.

This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent.

MrNase 10 Jun 2005 16:30

What does $newuser->errors look like? Is it an array() so that we have to use foreach ( ... AS ...) { } to display them?

Andreas 10 Jun 2005 16:34

Example (Username already taken):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Revan 10 Jun 2005 17:24

Good, thanks for clarifying the array. I wrote my own error handler for the events I needed to output any errors, and it was a simple foreach that went like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The $error was then echoed out in the print_standard_error.

Btw while Im at it, if we need to for instance add 2 users with different values, or send 2 pms, do we need to put the
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

line every time? Also do the variable names have to be different for those 2 instances?

TIA :)

Marco van Herwaarden 10 Jun 2005 17:54

Quote:

Originally Posted by MrNase
What does $newuser->errors look like? Is it an array() so that we have to use foreach ( ... AS ...) { } to display them?

Please read the stickied post in the top of this forum.

kall 15 Jun 2005 05:20

Quote:

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

So...we aren't allowed to ask questions in these How-to threads, is that what you are referring to the sticky thread for?

Seems a bit strange to me...surely that thread is meaning 'Don't Start question threads'.

N8 15 Jun 2005 05:59

I don't see the point in this, why not just create a new user via the admin cp?

Andreas 15 Jun 2005 06:03

Quote:

Originally Posted by N8_115
I don't see the point in this, why not just create a new user via the admin cp?

Quote:

Originally Posted by KirbyDE
As this is a common request for integration purposes,

Does this answer your question? :)

dwh 30 Jun 2005 00:37

What if you want to create a new user, assign him

$newuser->set('usergroupid', 10);



but you'd like his email verified first through the usual system and once he gets verified then he's placed in 10?

EDIT: I keep clicking on the black font color, in this screen the above text turns black. I hit enter, it reverts to green?

Andreas 30 Jun 2005 00:42

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.

dwh 30 Jun 2005 01:03

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 02 Jul 2005 12:38

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 12 Jul 2005 11:51

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 13 Jul 2005 01:41

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 28 Oct 2005 21:45

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

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

.....


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 03 Nov 2005 21:46

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

akanevsky 03 Nov 2005 22:07

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 03 Nov 2005 22:22

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

Andreas 03 Nov 2005 23:11

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

scott8539 03 Nov 2005 23:46

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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


akanevsky 03 Nov 2005 23:48

You shouldn't use CURL, as vBulletin data managers have data verifiers of their own. Just supply the raw values...

scott8539 03 Nov 2005 23:53

Quote:

Originally Posted by Dark Visor
You shouldn't use CURL, as vBulletin data managers have data verifiers of their own. Just supply the raw values...

I am not sure what you mean by supplying the raw values...that is pretty much what I am doing with cURL. What would be another way of supplying the values?

Wayne Luke 04 Nov 2005 00:11

Can anyone write a proof of concept on how this would be done? I mean a complete file that would accept POST values from another page, instantiate the manager and create the user?

akanevsky 04 Nov 2005 00:53

Of course. Except the official vB documentation provides all the information of this matter... At least about using GPC for POST values....

J75595E3F40B 04 Nov 2005 16:08

i got a script working that does the same thing, and i noticed one thing..... that script must be in the same directory as global.php

Dark_Wizard 05 Nov 2005 12:07

Quote:

Originally Posted by J75595E3F40B
i got a script working that does the same thing, and i noticed one thing..... that script must be in the same directory as global.php


Uhmm...incorrect. Try this piece from Dark Visor here about outside of vBulletin pages -> Using vBulletin-powered scripts outside vBulletin Directory.

Connector 27 Dec 2005 21:54

Quote:

Originally Posted by scott8539
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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


could someone please tell me how could we use this code ? i try it and give me error :devious:

scott8539 27 Dec 2005 22:09

Quote:

Originally Posted by Connector
could someone please tell me how could we use this code ? i try it and give me error :devious:

Geez, that was a long time ago and I have taken a completely different approach to it.

I do have my own way of creating a vB account from an external site. In fact, I just went live with it today.

forum.bodybuilding.com

If you click the register link, you will be redirected to a register script on a different site (my.bodybuilding.com -- different subdomain). There you enter your user information and submit. A new user is created in my Membership System, then the user is created in vBulletin.

The register, login/logoff, activation, recover lost password, edit email & password, etc, are are handled in my separate Membership System, pushing the results to vBulletin.

macks 29 Dec 2005 05:21

I am in the process of writing a user signup integration script. My forum runs on a separate server from my main site. I am going to need to write hooks in quite a few places. I've compiled a list of the spots where I will need to have remote vB hooks.

Initial user signup:
Add the user, put them in the email confirmation group. (my site sends a confirmation email).

Confirmation:
When the user clicks the link in the confirmation email.

Password and email changes:
When the user wants to change their email or password.

This will all need to be done from a remote server so I too will most likely be using cURL. Obviously I want to keep these changes in sync. It isn't fully clear to me if it would be easier to write a plugin with change password/email hooks that will update my system or if I should just deny these changes from the vBulletin side and change the permission denied template to point to the proper place on my site.

Once I've hammered through the few remaining issues, I will post my results and code here.

Quote:

Originally Posted by scott8539
Geez, that was a long time ago and I have taken a completely different approach to it.

I do have my own way of creating a vB account from an external site. In fact, I just went live with it today.

forum.bodybuilding.com

If you click the register link, you will be redirected to a register script on a different site (my.bodybuilding.com -- different subdomain). There you enter your user information and submit. A new user is created in my Membership System, then the user is created in vBulletin.

The register, login/logoff, activation, recover lost password, edit email & password, etc, are are handled in my separate Membership System, pushing the results to vBulletin.

Woops, just read your post and you seem to be describing everything I just mentioned. Care to give the rest of an idea of how long it took?

Connector 29 Dec 2005 14:21

Could someone put basic code how to do this ?

working example code here
by GrowersPro
05 Jan 2006 04:47

following code place earlier plus example of code for the curl call in php


STEP I

this file need to to be placed in the forum directory of vbulletin
(make sure it is in this directory to initialise vbulletin stuff ......)


no change done from previous poster


you can include the code below in one php page. call it whatever you want

i call it great_stuff_dude.php

thus i need to MAKE sure that the name of the page is correctly entered
in the define below

define('THIS_SCRIPT', 'GREAT_STUFF_DUDE.php');

do the same in the code below
----------------------------------------------------------------------
<?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', 'GREAT_STUFF_DUDE.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',qpc_post('usergroupid'));
$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";
}
?>
-------------------------------------------------------------------


STEP II



You can have the following code on server running PHP WHEREVER YOU WANT. it does not need to be on the same domain as long as you have the curl compiled


in that script (again call it whatever you want it does not matter)

you call the url of your web server and path to go to the page GREAT_STUFF_DUDE.php

you can of course include it in the login code of your CMS to create profiles in both systems in one step.


-------------------------------------------------------------------

<?php

$url="http://www.mysite.com/vbulletin3000/GREAT_STUFF_DUDE.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=keith_mayass&[email protected]_worrys.com&password=up_yours&usergr oupid=2&");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);

?>
---------------------------------------------------------

you can of course pass as may variables as you want if you have them available in your CMS to complete the profile.

like

parentemail
showbirthday
homepage
icq
aim
yahoo
msn
skype
usertitle
customtitle
birthday



__-----__________------___
Ni vu ni connu, jt' embrouille

Langly 07 Jan 2006 22:12

I use Postnuke, so which file in Postnuke to I put the curl code in and where in the file?

Connector 11 Jan 2006 07:12

This code dose not work i try it and give me error please Help :*

Langly 11 Jan 2006 13:00

Thread might be dead.

bkbelew 16 Mar 2006 19:06

Any update on this? I managed to add a user to the Vb database w/ just a couple simply mysql calls. But.... the password encryption was wrong ( i'm assuming ) it wouldn't allow the user to login. BUT if the user went through the lost password function, it would allow them to. Could someone help me w/ the command to encrypt the password w/ salt or whatever its using to add it into my database w/out having to hook anything from vb?

Thanks

Fume 30 Mar 2006 19:44

Quote:

Originally Posted by scott8539

If you click the register link, you will be redirected to a register script on a different site (my.bodybuilding.com -- different subdomain). There you enter your user information and submit. A new user is created in my Membership System, then the user is created in vBulletin.

The register, login/logoff, activation, recover lost password, edit email & password, etc, are are handled in my separate Membership System, pushing the results to vBulletin.

I'm looking for something exactly like that! Anyone know how I would accomplish this? :banana:

Altec 15 May 2006 12:52

I've managed to automatically add users to vBulletin via our website which is done in ASP. The only issue I'm having is that a user cannot 'SAVE' their signature (strange). Everything else works great...

Anyone have any ideas why?

Thanks.

Connector 15 May 2006 15:28

Why you have make it in ASP and not php ?

bigtime 30 May 2006 23:38

How would a new user be added without using curl?

Thanks,

Tim

bradsears 08 Jun 2006 21:51

Hi. I'd like to be able to send the registration email after the user registers. How do I do this. Thanks in advance.

-- edit --

I answered this one myself

$activateid = build_user_activation_id($newuserid, 2, 0);
eval(fetch_email_phrases('activateaccount'));
vbmail($email, $subject, $message, true);

asphix 21 Jun 2006 19:50

thanks a million for this script cause I really needed it
it works like a charm

bradsears 21 Jun 2006 19:53

I'd really like to be able to set the cookie and log the user in after they are instantly registered. Any ideas?

scorinaldi 10 Jul 2006 07:48

i agree wtih bradsears. can anyone shed some light on how to automatically log in a user?

do we just set the cookies and that's it?

workRelated 27 Jul 2006 02:13

I recently added a field to the user profile (gender)
I also renamed location to country
I would like to be able to automatically set these fields similarly to the other fields in the above example. Im unclear as to how this would be possible.

Any help would be greatly appreciated.

djdrey 05 Oct 2006 03:49

Quote:

Originally Posted by bigtime
How would a new user be added without using curl?

Thanks,

Tim

You don't have to use CURL to do it, but you have to include globals.php in your script root if you want to create the user from within a function or method.

You also have to remember to retrieve the global vbulletin variable to pass into the datamanager class.

I spent the last few hours working that out, hopefully it'll help someone else!

bigtime 05 Oct 2006 03:52

Thanks. Would you mind posting the code you used?

novastar 27 Oct 2006 04:59

i use a modified version of the code they gave a couple posts back which works great for me.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I would have taken more time to tinker with it, and possibilly put it in a function, but as there is only 1 place in my scripting but that works fine for me.
Im running it on vBulletin 3.6.2

XxRaidenxX 22 Dec 2006 10:25

Hello,

i use the code it's work fine but i have one problem. I can login the user but when i in the admincp and i edit the user i dont see any username in the inputfield! What is wrong?

Raiden

testebr 23 Dec 2006 14:24

Its possible verify if the usergroup exists before add to database the new user?

Exemple, to test I set the usergroup to 2000000 and VB ignore and inserted the user normally.

ps: same problem with password field, I set like empty and vbulletin inserted the data..

timedgar 13 Feb 2007 02:06

Hello All,


I'm using the following code, posted by Brad Sears, for sending out activation emails after adding a user via the script on this thread:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


It works, sort of. The only problem is that the email does not contain the username of the user being emailed (it begins "Welcome, (blank)"). The userid in the links and the email address it sends to are correct, but no username...

Do I need to pass additional variables to these functions?


Thanks!

Tim

Ba$im 24 Apr 2007 03:45

i dont know how do it?
let c what i can understand
first creat vB_Datamanager_User.php file then put this code and upload to vb folder in your site
then
ask this
http://yoursite/vb/vB_Datamanager_User.php
it just registerd 1 user???
and i should change username and email again and reupload???

how it does automatically???

can any one help me how do this plz

Spandauer 27 Apr 2007 18:56

Hi everybody,

is it also possible to pass a simple URL to a script, which takes the variables from the URL and registers the new user? The problem is, that i dont have the possibility to send something else... the only thing i can do for my project is sending an URL... will it be possible?

Poc1984 01 May 2007 01:09

Is it possible to use this and pass in a password that is already an md5 hash?

for example:

$userdm->set('password', "5f0f8c991d3d31c63ab531916c298c65");

Ba$im 29 Jun 2007 01:45

plz some 1 tell me how do that?

mpage 04 Jul 2007 16:42

Quote:

Originally Posted by Spandauer (Post 1236547)
Hi everybody,

is it also possible to pass a simple URL to a script, which takes the variables from the URL and registers the new user? The problem is, that i dont have the possibility to send something else... the only thing i can do for my project is sending an URL... will it be possible?

Yuo would just have to pass the variable to the cURL or modified script above via the _GET method . The cURL would then post this to the datamanager, Im just about to set this up myself, so Im no expert.

I will also have to use the modified method above since I cant install curl on my host.

I cant belive this isnt made easyier (for external sign ups)

Quote:

Originally Posted by djdrey (Post 1090273)
You don't have to use CURL to do it, but you have to include globals.php in your script root if you want to create the user from within a function or method.

You also have to remember to retrieve the global vbulletin variable to pass into the datamanager class.

I spent the last few hours working that out, hopefully it'll help someone else!



How can you have globals.php in your script root for a 2nd host/server/url, unless its coppied over, or the registration code is also in the root of forum.

Hmm, Ill look into this!

thbertram 05 Jul 2007 19:51

This is making driving me batty... With the "save" line commented, no errors are found. When I uncomment it, the data gets saved, BUT the error message line executes as if the entire program reruns itself. The 2 errors generated are duplicate username and duplicate email. Anyone have any ideas?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Searchworm1 19 Jul 2007 02:03

My God - the curl thing worked. It took me all week to find this post. Thanks.

beejeebers 19 Jul 2007 19:24

Novastar's script worked beautifully on the first try!

Thanks dude.

:)

mpage 23 Jul 2007 22:36

anyone having trouble with new users not getting a welcome post via datamanager, no idea how to make sure new users get a welcome post, there must be a way

RonInMaine 31 Jul 2007 16:55

When I use any variations of the scripts (with cURL and without) in this thread, I get these errors:

Notice: Undefined index: HTTPS in /var/www/html/includes/class_core.php on line 1599
Notice: Undefined index: HTTPS in /var/www/html/includes/class_core.php on line 1599
Notice: Undefined index: HTTP_REFERER in /var/www/html/includes/class_core.php on line 1626

I'm using VB 3.6.7 -- has something changed in this version that might be causing this? Is there another file I need to include to get the environment set up right?

I see where these indices are used in class_core.php, but I haven't (yet) found where they are defined. Still looking ...

Any suggestions would be appreciated.

Thanks,
Ron.

Okay, I'm not thinking straight. Of course, php sets the $_Server superglobal. SO, I guess my job is to find out why the HTTPS and HTTP_REFERER values are not being set.

Thanks,
Ron.

Marco van Herwaarden 31 Jul 2007 18:28

Add the following to the top of your script:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


RonInMaine 31 Jul 2007 18:57

Thank you. That worked nicely.

But, now you've got me curious. How did changing the error reporting options fix the problem?

Thanks,
Ron.

psalzmann 09 Aug 2007 07:02

Brilliant! Thanks Novastar!

blogtorank 12 Aug 2007 08:40

I've made it possible for you all to start creating members automatically here in this new hack:

http://www.vbulletin.org/forum/showthread.php?t=154637

I branched differently with all full sources of .NET and PHP using what I seen on the forums here with my .NET, and putting it all to work within XML_RPC I hope this helps others out as well.

Adding user fine.. how about updating them?
by psalzmann
15 Aug 2007 04:52

We are using novastar's hack as mentioned above and it's working fine. However, adding users is one thing, updating is another .. which brings me to my next question:

Will this work to actually "update" an existing user, all we're trying to do is update an existing user in the forum to a new usergroup:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But before I execute and implement that code above, I just want to make sure this won't actually "insert/register or create" a user, I would like to just update.

Any clues? is there a $userdm->update(); instead of save? I noticed a pre_save() option and now it's got me a bit curious :)

Thanks in advance!

Okay I did some more reading.. would someone be able to verify the following code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

TIA

blogtorank 15 Aug 2007 05:22

Quote:

We are using novastar's hack as mentioned above and it's working fine. However, adding users is one thing, updating is another .. which brings me to my next question:

Not off hand I don't think there is anything that can make it update without modifying the code to make it UPDATE, unless you make the set work as an update within a sql statement inside your PHP code....

taras 06 Sep 2007 04:06

Hey novastar
How do you pass varibles from another DB?
we tryed:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But it's not working...



Quote:

Originally Posted by novastar (Post 1105250)
i use a modified version of the code they gave a couple posts back which works great for me.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I would have taken more time to tinker with it, and possibilly put it in a function, but as there is only 1 place in my scripting but that works fine for me.
Im running it on vBulletin 3.6.2


skattabrain 08 Oct 2007 16:33

novastar ... added user without trouble, thanks!

any ideas on how to add the custom field data?

PHP class for user account operations
by amatulic
13 Oct 2007 06:16

After much testing and examining vBulletin code, I finally finished my PHP class for performing basic operations on user accounts (create user, modify user, delete user, log on, log off). This has enabled me to integrate the forum into my site. Users who log in to my site are logged in to the forum, users who register on my site automatically get an account on the forum, etc.

Once that was done, I just had to modify all the vBulletin templates that contained a login form, logout link, register link, or user account modification link, and make sure those things use MY code for those functions. Now users can log in either from the forum or from my main site, and user account registration and modification are all handled on my main site, outside of the forum. It all works pretty well, without modifying a single line of the vBulletin source code.

Here is the code for class.forumops.php, with extensive usage comments:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

As you can see, most of the operations above are pretty simple, except for the user deletion function. Also, to update user account information, see the first post of this thread for options you can use.

The wordwrapping above looks funny, but if you quote this message as if to reply, the wordwrapping will be correct when you copy and paste it.

I hope this helps some people.
-Alex

Lordy 14 Oct 2007 21:47

When using your code (amatulic), I get
Quote:

Fatal error: Call to a member function query_first() on a non-object in /home/lordy/domains/animefill.com/public_html/project/forum/includes/class_dm_user.php on line 380
I'm passing the variables this way


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

line 380 is

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


amatulic 15 Oct 2007 04:20

Quote:

Originally Posted by Lordy (Post 1359988)
When using your code (amatulic), I get "Fatal error: Call to a member function query_first() on a non-object in /home/lordy/domains/animefill.com/public_html/project/forum/includes/class_dm_user.php on line 380"

Odd. It's working for me. Try this hard-coded example, in the same directory where you have class.forumops.php. You can run it from the commandline:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You can go to the admin control panel "Prune / Move Users" and verify the user account 'test_user' got created. I just did a diff of what I posted vs what I have, and the only difference I see is that I am now passing the username by reference to delete_user(). That shouldn't make any difference. I'll update my source in my previous message anyway.
-Alex

Lordy 17 Oct 2007 22:16

Yup, seems that that does work. Can't seem to figure out how to do.

I tried putting

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

in my config file, and just including it. I think i'll probably have to code around that as it seems its setting some issues

I'll have to debug this on my end it seems.

I think I may have figured it out.

thanks =) I'll post back when I have a definite answer.

Lordy 19 Oct 2007 02:26

Recoded my reg form and it works fine now. Can't seem to work out the login form, so I looked at your login script.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

which i'm assuming is that? if so, passing as $forum->login($userdata) is not working for me, but looking through your code, I also don't know if that does work.

A58676333470 20 Oct 2007 02:06

Weee! EXACTLY what im looking for @amatulic ! Works Perfect! Thx!

SolidSlug 24 Nov 2007 07:32

amatulic,

Your code works great from a PHP page that has no other includes, but as soon as I plugged it into my own CMS, I got the dreaded:

PHP Fatal error: Call to a member function query_first_slave() on a non-object in /var/www/html/papatangopapa.com/forums/includes/functions.php on line 1194

My CMS has its own session management stuff and also uses a custom __autoload function, I wonder if that breaks things in some weird way.

--------------- Added 24 Nov 2007 at 17:36 ---------------

I think it's due to vBulletin's insane reliance on global variables.

When you have:

A.php including init.php and functions.php directly,

there is no problem.

When you have:

a function in B.php including including C.PHP, which includes init.php and functions.php,

you get:

PHP Fatal error: Call to a member function query_first_slave() on a non-object in /var/www/html/papatangopapa.com/forums/includes/functions.php on line 1194

--------------- Added 24 Nov 2007 at 17:43 ---------------

That's also how and why you might end up using cURL in order to keep your application and the namespace polluting vBulletin back-end completely separate.

stoppy 25 Nov 2007 23:24

Hi!
I'm using 3.6.8 version, I'm trying to add user to vb using my own registration system.

The constructor of the class I have take 2 parameters in input

function vB_DataManager_User(&$registry, $errtype = ERRTYPE_STANDARD)

How I have to use it?

May I include directly this class in my code... it look like not... How can I do?

I proposed another way to solve this problem here: http://www.vbulletin.org/forum/showt...27#post1389327

Thanks

Does this work with 3.6.8?
by Moooooon
01 Dec 2007 22:55

Would this approach still work in 3.6.8?

Quote:

Originally Posted by GrowersPro (Post 864803)
following code place earlier plus example of code for the curl call in php


STEP I

this file need to to be placed in the forum directory of vbulletin
(make sure it is in this directory to initialise vbulletin stuff ......)


no change done from previous poster


you can include the code below in one php page. call it whatever you want

i call it great_stuff_dude.php

thus i need to MAKE sure that the name of the page is correctly entered
in the define below

define('THIS_SCRIPT', 'GREAT_STUFF_DUDE.php');

do the same in the code below
----------------------------------------------------------------------
<?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', 'GREAT_STUFF_DUDE.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',qpc_post('usergroupid'));
$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";
}
?>
-------------------------------------------------------------------


STEP II



You can have the following code on server running PHP WHEREVER YOU WANT. it does not need to be on the same domain as long as you have the curl compiled


in that script (again call it whatever you want it does not matter)

you call the url of your web server and path to go to the page GREAT_STUFF_DUDE.php

you can of course include it in the login code of your CMS to create profiles in both systems in one step.


-------------------------------------------------------------------

<?php

$url="http://www.mysite.com/vbulletin3000/GREAT_STUFF_DUDE.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=keith_mayass&[email protected]_worrys.com&password=up_yours&usergr oupid=2&");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);

?>
---------------------------------------------------------

you can of course pass as may variables as you want if you have them available in your CMS to complete the profile.

like

parentemail
showbirthday
homepage
icq
aim
yahoo
msn
skype
usertitle
customtitle
birthday



__-----__________------___
Ni vu ni connu, jt' embrouille


makouvlei 06 Dec 2007 21:59

Quote:

Originally Posted by Altec (Post 975567)
I've managed to automatically add users to vBulletin via our website which is done in ASP. The only issue I'm having is that a user cannot 'SAVE' their signature (strange). Everything else works great...

Anyone have any ideas why?

Thanks.

I am looking to implement a similar system managing vBulletin users from an asp site. I'm very comfortable with asp, but not at all with php -- any pointers as to how to (and how not to) approach this would be much appreciated.

Auto Actavation
by jazeera
10 Dec 2007 13:39

Quote:

Originally Posted by GrowersPro (Post 864803)
following code place earlier plus example of code for the curl call in php


STEP I

this file need to to be placed in the forum directory of vbulletin
(make sure it is in this directory to initialise vbulletin stuff ......)


no change done from previous poster


you can include the code below in one php page. call it whatever you want

i call it great_stuff_dude.php

thus i need to MAKE sure that the name of the page is correctly entered
in the define below

define('THIS_SCRIPT', 'GREAT_STUFF_DUDE.php');

do the same in the code below
----------------------------------------------------------------------
<?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', 'GREAT_STUFF_DUDE.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',qpc_post('usergroupid'));
$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";
}
?>
-------------------------------------------------------------------


STEP II



You can have the following code on server running PHP WHEREVER YOU WANT. it does not need to be on the same domain as long as you have the curl compiled


in that script (again call it whatever you want it does not matter)

you call the url of your web server and path to go to the page GREAT_STUFF_DUDE.php

you can of course include it in the login code of your CMS to create profiles in both systems in one step.


-------------------------------------------------------------------

<?php

$url="http://www.mysite.com/vbulletin3000/GREAT_STUFF_DUDE.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "username=keith_mayass&[email protected]_worrys.com&password=up_yours&usergr oupid=2&");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML
curl_close ($ch);

?>
---------------------------------------------------------

you can of course pass as may variables as you want if you have them available in your CMS to complete the profile.

like

parentemail
showbirthday
homepage
icq
aim
yahoo
msn
skype
usertitle
customtitle
birthday



__-----__________------___
Ni vu ni connu, jt' embrouille

This code is work properly
then i need to activate this user when his account on my site activated

--------------- Added 11 Dec 2007 at 07:09 ---------------

Quote:

Originally Posted by Moooooon (Post 1393155)
Would this approach still work in 3.6.8?

it works properly i'm using 3.6.8

TheNewWebGuy 18 Dec 2007 14:53

Quote:

Originally Posted by amatulic (Post 1358740)
I hope this helps some people.
-Alex

I've been trying to get your code working, but I keep getting the error


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And that's from just having

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I can't see anything that would be amiss so any help would be welcomed

Thanks

--------------- Added 18 Dec 2007 at 15:30 ---------------

Quote:

Originally Posted by TheNewWebGuy (Post 1403576)

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I was able to fix this by doing te following

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Stiil though, I'm not sure why I can see $vbulliten outside of the class yet not inside it

dionsis 10 Jan 2008 18:43

Ok can anyone including the developers out there suggest a method for solving

PHP Fatal error: Call to a member function query_first_slave() on a non-object in /path/to/my/forum/includes/functions.php on line 1194

from doing a bit of research it seems this error comes up mostly when a file X.php included file Y.PHP and Y.PHP would include the code for adding a user and in turn would include the globals.php, class_dm.php and class_dm_user.php

so it seems nested including is a problem for objects further down the line

has anyone got any idea's of how we can solve this issue as i'd like to make use of the datamanager for inserting users rather than the silly method of SQL inserting which isnt the best method going

Opserty 11 Jan 2008 15:35

Quote:

Originally Posted by dionsis (Post 1419037)
Ok can anyone including the developers out there suggest a method for solving

PHP Fatal error: Call to a member function query_first_slave() on a non-object in /path/to/my/forum/includes/functions.php on line 1194

from doing a bit of research it seems this error comes up mostly when a file X.php included file Y.PHP and Y.PHP would include the code for adding a user and in turn would include the globals.php, class_dm.php and class_dm_user.php

Make sure you include global.php (not globals.php) at the very top of your script, the advised method of doing so is with a chdir().

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Try it out.

dionsis 14 Jan 2008 02:32

i do include global.php

Quote:

$cwd = getcwd();
chdir('/home/content/d/i/o/dionsis/html/acuffe/test/forum');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
chdir($cwd);

$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);

$userdm->set('username', $username);
$userdm->set('email', $email);
$userdm->set('password', $password);
$userdm->set('usergroupid',$usergroupid);
//$userdm->set('ipaddress', $ipaddress);
$userdm->set('timezoneoffset', $timezoneoffset);
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');

#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";
return(false);
}
}
else
{
# If everything is OK
$newuserid = $userdm->save();
print "vbuserid:$newuserid\n";
return(true);
}

dionsis 24 Jan 2008 14:08

Nobody have any idea's on this? i might post this to the vbulletin programming forum and see if anyone see's it better there

scoopr 01 Feb 2008 14:26

I was pleased to find amatulic's class.forumops.php as that was exactly what I needed, excellent work!

However, I found the user login part of it acting a bit weird.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If you look at the function, it does not use the $vbuser['password'] value at any point! This means, if you use this login function in some page, it logs in successfully any user no matter what she supplied as her password!

You might need forcing successful login when you have custom user database you check against yourself and want to ignore vbulletin user database and still be logged in to vbulletin, but in my eyes, the class implied it actually checked against the vb user database (the comments have an example where it supplied the password).

I replaced the login method as follows, now it returns true when the login is successfully, false otherwise. I'm not totally sure if the md5 passwords are totally correct here, but seem to work in my quick test.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Feel free to comment if I had misunderstood something, but I felt it would be important bring this issue up, if someone else uses this class as a login method assuming the same thing as I did.

Oh, and this skips the userdata conversion part, as I felt it was a bit pointless in this context.

Iron Guard 11 Feb 2008 10:32

I have found the datamanager_user class (class_dm_user.php) in the includes folder of the vbulletin directory on my server.

Now could anybody please suggest me what files do I need to include in my script before I could instantiate the datamanager object and run the add process successfully?

1. What files do I need to include in my script to create a database connection?
2. Any function files that I need to include to run the process successfully?
3. Any other class file that is related with this class_dm_user.php file and required to be included as well?

Thanks.

WebConnection 14 Feb 2008 08:10

Is there any tables may be affected when adding a new user except for the 'user' table? If so, what are they?

How to add user custom avatar
by matzelkoenig
25 Mar 2008 18:55

I am using your functions in my project and it worked very well! But now I want to add also an customavatar picture for new users. How can I do this with your ForumOps Code?

upnorth 01 Apr 2008 15:04

Can anyone tell me where there might be a complete updated list of what can be set for a new user in vB 3.6.9 Seems the list provided in the initial post (see below) is a little dated.

Quote:

Originally Posted by Andreas (Post 664586)
...
You can also set many other info too:
  • membergroupids = comma-separated string of all additional usergroups (Default=Empty)
  • displaygroupid = ID of the usergroup this user should show up as (Default=0)
    Note that this must be set after usergroupid and membergroupids!
  • styleid = ID of the Style to be used by this user (Default=Board Default)
  • languageid = ID of the language to be used by this user (Default=Board Default)
  • threadedmode = Whether to use Flat (0), Hybrid (1) or Threaded (2) Display Mode
  • maxposts = Integer, how many posts should be shown on one Page (Default=Board Default)
  • ipaddress = String, IP-Adress of the User registering (Default=Empty)
  • refererid = String, Username or UserID of the User this user was refered by
  • parentemail = String. eMail-Address of the users Parents
  • daysprune = Integer, show threads from the last X days
  • startofweek = Integer, When does the week start (1=Sunday, 2=;onday, ...) (Default=Board Default)
  • timezoneoffset = Integer, spexifying the Timezone (-12 .. +12)
  • autosubscribe = Integer, defining default mode for Thread subscription
    -1 = no Subscription, 1 = Instant, 2 = Daily Digest, 3 = Weekly Digest
    (Default=Board Default)
  • homepage = String, URL of the users Homepage (Default=Empty)
  • icq = String, the Users ICQ # (Default=Empty)
  • aim = String, the Users AIM ID (Default=Empty)
  • yahoo = String, the Users Yahoo ID (Default=Empty)
  • MSN = String, the Users MSN ID (Default=Empty)
  • usertitle = String, the Usertitle this user should have
  • customtitle = Integer, defining behaviour of Usertitle. 0=No Custom Title, 1=Custom, Title with HTML, 2=Custom Title without HTML (Default=
  • birthday = array(month, day, year). The users birthdate.
  • avatarid = Integer, ID of the Avatar being used for this user
  • signature = String. The Users Signature
  • subfolders = Array. The Users Subscription Folders
  • pmfolders = Array. The Users Subscription Folders
  • buddylist = String. Space separated List of UserIDs defining the Users buddylist
  • ignorelist = String. Space separated List of UserIDs defining the Users ignorelist
...
  • showsignatures = Show Signatures
  • showavatars = Show Avatars
  • showimages = Show Images, incl. attached Images and [img] BBCode
    If this is not set they will show up as links
  • coppauser = User is COPPA User
  • adminemail = Receive Admin eMails
  • showvcard = Allow vCard Download
  • dstauto = Automatically detect DST setting
  • dstonoff = DST turned On
  • showemail = Receive eMails from other Users
  • invisible = Be invisible
  • showreputation = Show Reputation
  • receivepm = PM turned on
  • emailonpm = eMail notification for new PMs

....


Opserty 02 Apr 2008 10:14

Quote:

Originally Posted by upnorth (Post 1480002)
Can anyone tell me where there might be a complete updated list of what can be set for a new user in vB 3.6.9 Seems the list provided in the initial post (see below) is a little dated.

I don't think there have be many changes, maybe just ask about a specific field either in this thread of one of the other vBulletin.org forums.

upnorth 02 Apr 2008 16:49

The ones I seem to be running into problems with are the ones below:

$newuser->set_bitfield('options', 'receivepm', '1');
--this dosn't seem to set the "Receive Private Messages" for the user to "Yes"

$newuser->set_bitfield('options', 'emailonpm', '1');
--this dosn't seem to set the "Send Notification Email When a Private Message is Received" for the user to "Yes"

Pop up a Notification Box When a Private Message is Received
--not sure what the option is to set this one?

Opserty 02 Apr 2008 17:59

Try:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Does that work?

upnorth 02 Apr 2008 18:19

nope, didn't work

How about using it on 6.7?
by JulienT
13 Apr 2008 20:13

This was a really good code that helped me integrate VB with my existing website.
Any idea if those functions will still work in 6.7?
I will wait for the final release of course of 6.7, but having this code working is a key factor for me to upgrade or not.

So if someone has tried this code on 6.7, please let us know.

Thanks.

binevi 14 Apr 2008 00:03

Can anyone explain step by step? How and where do we suppose to put these codes ;(

upnorth 24 Apr 2008 19:28

Still running into problems with these as well as showimages

Anyone? Anyone lol :D

Quote:

Originally Posted by upnorth (Post 1480978)
The ones I seem to be running into problems with are the ones below:

$newuser->set_bitfield('options', 'receivepm', '1');
--this dosn't seem to set the "Receive Private Messages" for the user to "Yes"

$newuser->set_bitfield('options', 'emailonpm', '1');
--this dosn't seem to set the "Send Notification Email When a Private Message is Received" for the user to "Yes"

Pop up a Notification Box When a Private Message is Received
--not sure what the option is to set this one?


coffeesgr 25 May 2008 12:20

Anyone know how to fix error:
Quote:

Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 177
#0 vb_error_handler(256, Registry object is not an object, /home/gymchat/public_html/messageboards/includes/class_dm.php, 177, Array ([this] => vB_DataManager_User Object ([validfields]

Quote:

Originally Posted by novastar (Post 1105250)
i use a modified version of the code they gave a couple posts back which works great for me.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I would have taken more time to tinker with it, and possibilly put it in a function, but as there is only 1 place in my scripting but that works fine for me.
Im running it on vBulletin 3.6.2


Maybe this can be addressed more fully?
by grenma
28 May 2008 02:02

This is the only auto-login/auto-register/integration information in all of support as far as I can tell. It is 3 years old and, while giving thanks to the author and noting that it is better than nothing, it hardly classifies as much more than a code snippet. I've seen dozens of posts on integration here that could be addressed by expanding and updating this information- surely it is not too much to ask?

--------------- Added 28 May 2008 at 04:01 ---------------

Thank You!

--------------- Added 28 May 2008 at 04:03 ---------------

Quote:

Originally Posted by coffeesgr (Post 1530799)
Anyone know how to fix error:

This did the trick for me

--------------- Added 28 May 2008 at 04:05 ---------------

changing to the vb install directory is the key

coffeesgr 28 May 2008 05:25

What fixed the error for you?

This does change to the vb directory:
chdir('/home/site/public_html/forum');

wassimeh 10 Jun 2008 16:35

Thanks coffeesgr your code works #1 when executed directly; unfortunately it won't work when i use it inside a $_POST action.. please help.. what am I doing wrong ? here's my code below

Quote:

<?php
//Ajouter l'utilisateur dans la database du forum
if(isset($_POST['btn_update'])){
/*
$username=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];
$usergroupid=$_POST['usergroupid'];
$timezoneoffset="-5";
*/
$username="username";
$email="[email protected]";
$password="password";
$usergroupid="2";
$timezoneoffset="-5";

define('THIS_SCRIPT', 'remote_register.php');
chdir('forum/');
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', $username);
$userdm->set('email', $email);
$userdm->set('password', $password);
$userdm->set('usergroupid',$usergroupid);
$userdm->set('ipaddress', $ipaddress);
$userdm->set('timezoneoffset', $timezoneoffset);
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');

#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();
}
chdir('..');
}


?>
<form name='f_updaccess' method='post' action='test.php'>
username : <input type='textarea' name='username' value='user2'>
email : <input type='textarea' name='email' value='[email protected]'>
pass : <input type='textarea' name='password' value='password'>
usergroup : <input type='textarea' name='usergroupid' value='9'>
<input type='submit' name='btn_update'>
</form>


All times are GMT. The time now is 05:22.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.