vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Populating a field defined in 'User Profile Field Manager' (https://vborg.vbsupport.ru/showthread.php?t=247531)

kharmer 07-29-2010 01:09 PM

Populating a field defined in 'User Profile Field Manager'
 
Hi all,

I am working on an API to allow an external site to create and update accounts in vB4.

All is working fine when creating and updating accounts with default fields like username/password/email.

However, we have some custom fields defined in the 'User Profile Field Manager'; they are named field1/field2.../field5 etc.

This is part of the code that falls over when attempting to create an account including a custom field:

PHP Code:

        // init user datamanager class
        
$newuser =& datamanager_init('User'$vbulletinERRTYPE_ARRAY);
        
        
// set username
        
$newuser->set('username',    $username,    true);

        
// set email
        
$newuser->set('email',        $email,        true);

        
// set password
        
$newuser->set('password',    $password,    true);

        
// set xxx
        
$newuser->set('field5',    $xxx,    true); // Custom field defined from 'User Profile Field Manager' 

I have read about the data managers but am not sure what DM model I should be referencing when trying to save to this custom field.

Could anyone please advise.

Kind regards,
Kris...

Lynne 07-29-2010 02:12 PM

If you want the datamanager to update a field, you need to first make sure it is in the datamanager array - in this case the one for the User datamanager (in class_dm_user.php). You'll have to add it to that array $validfields there. You'll want to read the code for the fields that go into the usertextfield table since they go into a separate table and are treated specially and you will have to do the same with your field5 (it goes into the userfield table).

kharmer 07-30-2010 07:55 AM

Thanks Lynne for the pointer; I think I've done it correctly as it is working. ;o)

Cheers,
Kharmer...


All times are GMT. The time now is 07:03 PM.

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.00994 seconds
  • Memory Usage 1,719KB
  • 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
  • (3)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