vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   User DM (https://vborg.vbsupport.ru/showthread.php?t=82950)

merk 06-12-2005 12:23 PM

User DM
 
Im trying to modify a couple of userfields using the new user data manager.

code:

PHP Code:

$userfields = array('field7' => $data1'field8' => $data2);

$userdata datamanager_init('User'$vbulletinERRTYPE_STANDARD);
$userdata->set_existing($userinfo);
if(
$userdata->set_userfields($userfields))
{
    
$userdata->save();
} else { 
    echo 
"failed";


$userinfo is retrieved from fetch_userinfo();.

The script returns "failed". I have no idea why, and im having a bit of trouble following the class structures this late at night.

Any ideas? :)

Getting slightly closer, it appears the array needs to contain fieldx_set and _opt (set being set to 1, opt as far as i know set to 1 if the field is optional?)

Still didnt work though. /me keeps looking.

VBCoder 06-12-2005 01:09 PM

The example showed using a =& datamanager_init , not just a plain =

merk 06-12-2005 01:11 PM

Thanks for picking that up. Changed but $userdata->set_userfields is still returning false.

Its weird :\

Okay, found the problem. It appears that the array stuff earlier was partly to blame, and that non editable userfields are not updated by these functions.

Time to go report a bug :)

VBCoder 06-12-2005 05:55 PM

merk, instead of if(set..) save(), try if (!$userdata->errors) save else print_r errors

(shorthand, but you get the idea)


All times are GMT. The time now is 08:39 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.00909 seconds
  • Memory Usage 1,714KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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