vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Setting user profile fields with the data manager (https://vborg.vbsupport.ru/showthread.php?t=199146)

TJFweb 12-18-2008 03:46 AM

Setting user profile fields with the data manager
 
Hi,

Alright, I finally have a script working which will insert users into my vBulletin installation when POSTed to. See the following:

Code:

<?php
ob_start();
define('THIS_SCRIPT', 'add_user.php');
chdir('C:\path\to\httpdocs');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');

$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$usergroupid = $_POST['usergroupid'];
$timezoneoffset = $_POST['timezoneoffset'];
$key = $_POST['key'];
$valid_key = md5($username . iwca_astound_world_success_88_1973);

#if ($key != $valid_key) {
#exit("Incorrect Key");
#}

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

echo "Account created!";  }

chdir('C:\path\to\httpdocs');
ob_end_flush();

?>

Now my question is - how can I modify this script to allow user profile fields to be set too?

According to this post (https://vborg.vbsupport.ru/showpost....61&postcount=6), the data manager can't set custom fields. He did however provide code, which unfortunately I don't quite understand. Could someone please tell me how I could insert this code into my add_user.php script to set user profile fields after creating their account with the data manager?

Thanks a lot in advance!

Tancey 02-01-2010 09:59 AM

i would like to know this also


All times are GMT. The time now is 01:12 AM.

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.01036 seconds
  • Memory Usage 1,712KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete