Author Topic: Assigning values to additional_user_fields without using forms  (Read 2331 times)

0 Members and 1 Guest are viewing this topic.

Offline Noobern

  • Pre-Newbie
  • Posts: 1
    • View Profile
Hi,

4images is kind of uknown territory and my PHP is at novice level. I have tied to get a grip of things by researching the code and forum, but still ned some help.

I was hoping that I would be able to use the additional_user_fields for including custom-generated data to the database during signup. I'm trying to write a value to an additional_user_field without capturing the data using a form, but seem to be unable to get my value into the database.

I've followed the recipe by creating the field 'user_some_var' in "4images_users" and modifying the following files:

In file: db_field__definitions.php
   Add:
Code: [Select]
$additional_user_fields['user_some_var'] = array($lang['user_some_var'], "text", 0);
   In file: lang/main.php
   Add:
Code: [Select]
$lang['user_some_var'] = "user_some_var";
Im trying to assing a value to my additional_user_field by the line below, but it leaves a blank field in the db.
   In file: register.php
   Add:
Code: [Select]
$user_some_var = "1234";
If I use the method for picking variables from the form, by including the user_some_var as a hidden form variable, the value from the form succeeds to the database.
   In: templates/default/register_form.html
   Add:
Code: [Select]
<input type="hidden" name="user_some_var" value="unset_no_value">
   In file: register.php
   Add:
Code: [Select]
$user_some_var = (isset($HTTP_POST_VARS['user_some_var'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_some_var'])) : "";
   This leaves 'unset_no_value' (value from the form) in the database, but assigning a new value on the following line with '$user_some_var = "1234";' does not override the value from the form.
   
Some help with understanding how to manipulate the additional_user_fields would be nice.