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)

upnorth 04-02-2008 02:49 PM

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 04-02-2008 03:59 PM

Try:
PHP Code:

 $newuser->set_bitfield('options''receivepm'true); 

Does that work?

upnorth 04-02-2008 04:19 PM

nope, didn't work

JulienT 04-13-2008 06:13 PM

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 04-13-2008 10:03 PM

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

upnorth 04-24-2008 05:28 PM

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 05-25-2008 10:20 AM

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.
Code:

<?php
$username="username";
$email="email@address.com";
$password="password";
$usergroupid="2";
$timezoneoffset="-6";
define('THIS_SCRIPT', 'remote_register.php');
chdir('/home/site/public_html/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();
print "vbuserid:$newuserid\n";
}
chdir('/home/site/public_html/');
?>

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


grenma 05-28-2008 12:02 AM

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 [DATE]1211943709[/DATE] at [TIME]1211943709[/TIME] ---------------

Thank You!

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

Quote:

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

This did the trick for me

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

changing to the vb install directory is the key

coffeesgr 05-28-2008 03:25 AM

What fixed the error for you?

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

wassimeh 06-10-2008 02:35 PM

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@address.com";
$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@haha.ca'>
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 12:42 AM.

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.01496 seconds
  • Memory Usage 1,756KB
  • 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
  • (4)pagenav_pagelink
  • (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