• [MOD] Dropdown options for custom database fields 4 0 5 1
Currently:  

Author Topic: [MOD] Dropdown options for custom database fields  (Read 198572 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Dropdown options for custom database fields
« on: March 29, 2005, 08:30:22 PM »
This mod will add new feature to use dropdown options for custom database fields, that could be specifyed in /includes/db_field_definitions.php

-------- [ Installation ] ---------

4images v1.7.6 and newer

Step 1

:flag-en: Open members.php
:flag-de: Öffne members.php

:flag-en: search:
:flag-de: suche:  
Code: [Select]
else {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(stripslashes(trim($HTTP_POST_VARS[$key]))) : $image_row[$key];
      }

:flag-en: Insert above  
:flag-de: füge darüber ein:

Code: [Select]
elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(stripslashes(trim($HTTP_POST_VARS[$key]))) : $image_row[$key];
        $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }

Step 1.1

:flag-en: search:
:flag-de: suche:

Code: [Select]
else {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(trim($HTTP_POST_VARS[$key]), 2) : $user_info[$key];
      }

:flag-en: Insert above:
:flag-de: füge darüber ein:

Code: [Select]
elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(trim($HTTP_POST_VARS[$key]), 2) : $user_info[$key];
        $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }


Step 2
:flag-en: Open register.php
:flag-de: Öffne register.php

:flag-en: search:
:flag-de: suche:

Code: [Select]
else {
            $additional_field_array[$key.'_yes'] = "";
            $additional_field_array[$key.'_no'] = " checked=\"checked\"";
          }
        }

:flag-en: Replace with:
:flag-de: ersetze mit:

Code: [Select]
else {
            $additional_field_array[$key.'_yes'] = "";
            $additional_field_array[$key.'_no'] = " checked=\"checked\"";
          }
        }
        elseif ($val[1] == "dropdown") {
          $value = (isset($HTTP_POST_VARS[$key])) ? $HTTP_POST_VARS[$key] : $user_info[$key];
           $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
        }


Step 3
:flag-en: Open includes/functions.php
At the end, above closing ?> insert:

:flag-de: Öffne includes/funktions.php
füge am ende vor ?> folgendes ein

Code: [Select]
function get_dropdown_options($name, $options = array(), $value = "", $multi_dim = 1, $number = 0, $auto = 0, $keypress = 0, $extra = "", $class = "", $i_start = 0, $i_step = 1, $i_stop = 1) {
  $keypress = ($keypress) ? " onkeypress=\"if(window.event.keyCode==13)this.form.submit();\"" : "";
  $auto = ($auto) ? " onchange=\"this.form.submit();\"" : "";
    $dropdown = "<SELECT name=\"".$name."\"".$auto.$keypress." class=\"".(($class) ? $class : "select")."\"".$extra.">\n";
   $i = $i_start;
  if (count($options)) {
    foreach ($options as $key => $val) {
       $what = (($number) ? $i : (($multi_dim) ? $key : $val));
        $dropdown .= "<option value=\"".$what."\"".(($value == $what) ? " selected" : "").">".preg_replace (array("/{key}/siU", "/{val}/siU", "/{what}/siU", "/{value}/siU"), array($key, $val, $what, $value), $val)."</option>\n";
        $i = $i + $i_step;
     }
  }else{
    for ($i = $i_start; $i <= $i_stop; $i += $i_step) {
        $dropdown .= "<option value=\"".$i."\"".(($value == $i) ? " selected" : "").">".$i."</option>\n";
    }
  }
   $dropdown .= "</select>\n";
  return $dropdown;
}
function get_db_fields_dropdown($key, $val, $value) {
  return get_dropdown_options($key, $val[3], $value, $val[4], $val[5], $val[7], 1, "", "select", $val[6]);
}


Step 4
:flag-en: Open admin/admin_functions.php
:flag-de: Öffne admin/admin_functions.php

:flag-en: search:
:flag-de: suche:

Code: [Select]
case "radio":
        show_radio_row($val[0], $field_name, ($value == "") ? 1 : $value);
        break;

:flag-en: Insert below:
:flag-de: füge darunter ein:

Code: [Select]
case "dropdown":
        show_user_dropdown_row($field_name, $val, $value);
        break;

Step 4.1

:flag-en: At the end, above closing ?> insert:

:flag-de: füge am ende vor ?> folgendes ein

Code: [Select]
function show_user_dropdown_row($name, $val, $value = 0){
  echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">".$val[0]."</p></td>\n";
  echo "<td><p>\n";
  echo get_dropdown_options($name, $val[3], $value, $val[4], $val[5], $val[7], 1, "", "select", $val[6]);
  echo "</p></td>\n</tr>\n";
}







4images v1.7 - v1.7.5

Step 1 (updated 05-22-2004)
Open members.php

Find two times:
Code: [Select]
     else {
        $value = (isset($HTTP_POST_VARS[$key])) ? htmlspecialchars(stripslashes(trim($HTTP_POST_VARS[$key]))) : "";
      }

Replace both of them with:
Code: [Select]
     elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? $HTTP_POST_VARS[$key] : $image_row[$key];
         $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }
      else {
        $value = (isset($HTTP_POST_VARS[$key])) ? htmlspecialchars(stripslashes(trim($HTTP_POST_VARS[$key]))) : ((isset($image_row[$key])) ? $image_row[$key] : "");
      }


4images v1.7.3

Find two times:
Code: [Select]
     else {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(stripslashes(trim($HTTP_POST_VARS[$key]))) : $image_row[$key];
      }

Insert above both of them:
Code: [Select]
     elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(stripslashes(trim($HTTP_POST_VARS[$key]))) : $image_row[$key];
        $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }



Step 1.1

4images v1.7

Find:
Code: [Select]
     else {
        $value = (isset($HTTP_POST_VARS[$key])) ? htmlspecialchars(trim($HTTP_POST_VARS[$key])) : $user_info[$key];
      }

Replace with:
Code: [Select]
     elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? $HTTP_POST_VARS[$key] : $user_info[$key];
         $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }
      else {
        $value = (isset($HTTP_POST_VARS[$key])) ? htmlspecialchars(trim($HTTP_POST_VARS[$key])) : $user_info[$key];
      }



4images v1.7.3

Find:
Code: [Select]
     else {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(trim($HTTP_POST_VARS[$key]), 2) : $user_info[$key];
      }

Insert above:
Code: [Select]
     elseif ($val[1] == "dropdown") {
        $value = (isset($HTTP_POST_VARS[$key])) ? format_text(trim($HTTP_POST_VARS[$key]), 2) : $user_info[$key];
        $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
      }




Step 2
Open register.php
Find:
Code: [Select]
         else {
            $additional_field_array[$key.'_yes'] = "";
            $additional_field_array[$key.'_no'] = " checked=\"checked\"";
          }
        }

Replace with:
Code: [Select]
         else {
            $additional_field_array[$key.'_yes'] = "";
            $additional_field_array[$key.'_no'] = " checked=\"checked\"";
          }
        }
        elseif ($val[1] == "dropdown") {
          $value = (isset($HTTP_POST_VARS[$key])) ? $HTTP_POST_VARS[$key] : $user_info[$key];
           $additional_field_array[$key.'_dropdown'] = get_db_fields_dropdown($key, $val, $value);
        }




Step 3 (updated 2005-12-01)
Open includes/functions.php
At the end, above closing ?> insert:
Code: [Select]
function get_dropdown_options($name, $options = array(), $value = "", $multi_dim = 1, $number = 0, $auto = 0, $keypress = 0, $extra = "", $class = "", $i_start = 0, $i_step = 1, $i_stop = 1) {
  $keypress = ($keypress) ? " onkeypress=\"if(window.event.keyCode==13)this.form.submit();\"" : "";
  $auto = ($auto) ? " onchange=\"this.form.submit();\"" : "";
    $dropdown = "<SELECT name=\"".$name."\"".$auto.$keypress." class=\"".(($class) ? $class : "select")."\"".$extra.">\n";
   $i = $i_start;
  if (count($options)) {
    foreach ($options as $key => $val) {
       $what = (($number) ? $i : (($multi_dim) ? $key : $val));
        $dropdown .= "<option value=\"".$what."\"".(($value == $what) ? " selected" : "").">".preg_replace (array("/{key}/siU", "/{val}/siU", "/{what}/siU", "/{value}/siU"), array($key, $val, $what, $value), $val)."</option>\n";
        $i = $i + $i_step;
     }
  }else{
    for ($i = $i_start; $i <= $i_stop; $i += $i_step) {
        $dropdown .= "<option value=\"".$i."\"".(($value == $i) ? " selected" : "").">".$i."</option>\n";
    }
  }
   $dropdown .= "</select>\n";
  return $dropdown;
}
function get_db_fields_dropdown($key, $val, $value) {
  return get_dropdown_options($key, $val[3], $value, $val[4], $val[5], $val[7], 1, "", "select", $val[6]);
}




Step 4
Open admin/admin_functions.php
Find:
Code: [Select]
     case "radio":
        show_radio_row($val[0], $field_name, ($value == "") ? 1 : $value);
        break;

Insert below:
Code: [Select]
     case "dropdown":
        show_user_dropdown_row($field_name, $val, $value);
        break;



Step 4.2
At the end, above closing ?> insert:
Code: [Select]
function show_user_dropdown_row($name, $val, $value = 0){
  echo "<tr class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">".$val[0]."</p></td>\n";
  echo "<td><p>\n";
  echo get_dropdown_options($name, $val[3], $value, $val[4], $val[5], $val[7], 1, "", "select", $val[6]);
  echo "</p></td>\n</tr>\n";
}




---------- [ How to use ] -----------

the format that u need to enter in includes/db_field_definitions.php must be like this:
Quote
$additional_user_fields['%column_name%'] = array("%field_description%", "%admin_field_type%", %is_required%, %dropdown_array% [, %is_multidimention%, %is_number%, %start_number%, %is_auto%]);


----------
%column_name% string

- Replace %column_name% with name of the table column.
You can use the tag {%column_name%_dropdown} in the templates to display the dropdown.

----------
%field_description% string

Replace %field_description% with a custom name. This name will be displayed in the Control Panel.
The value can be displayed in the templates with the tag {lang_%column_name%}.
It is also recommended to add this tag to the language files (main.php) and to replace "%field_description%"
with $lang['%column_name%']. (example: $lang['example'] = "Some description"; )

----------
%admin_field_type% string

- Replace %admin_field_type% with the type of input field you would like to use in your

----------
%is_required% bool

- Sets up the field as required when adding data through the Control Panel or the user upload form.

----------
%dropdown_array% array

- Array with a list of items for dropdown options.

----------
%is_multidimention% bool (optional. default 0)

- If %dropdown_array% is multidimetion array, set it to 1 otherwise 0

----------
%is_number% bool (optional. default 1)

- If %dropdown_array% is not multidimention array and you want use number in the value, set it to 1 otherwise 0

----------
%start_number% number (optional. default 0)

- Start number that will be used as value for first item in %dropdown_array%, when %is_number% is set to 1.

----------
%is_auto% bool (optional. default 0)

- Makes dropdown auto select (no need "submit" button)



--------- [ Examples ] ----------
 
Quote
$additional_user_fields['user_gender'] = array($lang['user_gender'], "dropdown", 0, array("---", "male", "female"), 0, 1, 5, 0);

it will produse template tag {user_gender_dropdown} with this code:

Code: [Select]
 <select name="user_gender" onkeypress="if(window.event.keyCode==13)this.form.submit();" />
    <option value="5">---</option>
    <option value="6">male</option>
    <option value="7">female</option>
  </select>



Quote
$additional_user_fields['user_gender'] = array($lang['user_gender'], "dropdown", 0, array("---", "male", "female"), 0, 0, 0, 1);

it will produse template tag {user_gender_dropdown} with this code:
 
Code: [Select]
 <select name="user_gender" onkeypress="if(window.event.keyCode==13)this.form.submit();" onchange="this.form.submit();" />
    <option value="---">---</option>
    <option value="male">male</option>
    <option value="female">female</option>
  </select>



Quote
$additional_user_fields['user_gender'] = array($lang['user_gender'], "dropdown", 0, array("n" => "---", "m" => "Male", "f" => "Female"), 1, 0, 0, 0);

it will produse template tag {user_gender_dropdown} with this code:

Code: [Select]
 <select name="user_gender" onkeypress="if(window.event.keyCode==13)this.form.submit();" />
    <option value="n">---</option>
    <option value="m">Male</option>
    <option value="f">Female</option>
  </select>

« Last Edit: September 16, 2010, 04:10:03 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bentleykf

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD] Dropdown options for custom database fields
« Reply #1 on: April 03, 2005, 03:31:25 AM »
the first step has a typo, with the first piece of code to find, you are missing a ";".
The second occurance of  that same code differs, with ": $image_row[$key];" at the end instead of nothing.

-bents

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #2 on: April 03, 2005, 06:16:51 AM »
Thank you.
I've fixed the step.

about the presense of $image_row[$key] - is a bug fix when values of additional fields not being populated in the edit image page.
I've updated the step so it would be more compatible with the first found instance.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Toso

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Lachs & Leder
Re: [MOD] Dropdown options for custom database fields
« Reply #3 on: April 06, 2005, 02:04:56 PM »
Hey V@no,

is it possible to show the selected value in member_editprofile.html?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #4 on: April 06, 2005, 02:09:24 PM »
sorry, I dont understand your question.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Toso

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Lachs & Leder
Re: [MOD] Dropdown options for custom database fields
« Reply #5 on: April 06, 2005, 02:26:58 PM »
O.k. I try to explain.

I have installed {user_gender_dropdown} in the userprofile.
If a user would like to change the value in his profile he can not see the last selection.


Sorry its very difficult to explain it... :cry:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #6 on: April 06, 2005, 02:29:46 PM »
If a user would like to change the value in his profile he can not see the last selection.
that should not have happend.
Perhaps u missed Step 1.1
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Dropdown options for custom database fields
« Reply #7 on: April 07, 2005, 01:54:40 AM »
Open members.php
Find two times:
I just find it once is this for 1.7.1 also?
I try replacing that one time and I did the other modifications and it seem to be "working" I put {user_gender} in member_prfoile.html to see the gender and I put male when I register and what I get is a 6 :S

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Dropdown options for custom database fields
« Reply #8 on: April 27, 2005, 07:13:19 PM »
Hi V@no ! , so if I want to do a drop down menu like the gender one but for states, do i have to put something like this?:

Code: [Select]
$additional_user_fields['user_state'] = array($lang['user_state'], "dropdown", 0, array("Madrid", "Barcelona", "Valencia", " ......","......","etc"), 1, 0, 0, 0);

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #9 on: April 28, 2005, 01:31:09 AM »
correct
and, for better "viewing" u can put every state on a new line, or load the list into an external variable:
Code: [Select]
$var = array("Madrid",
             "Barcelona",
             "Valencia",
             " ......",
             "......",
              "etc"
);
$additional_user_fields['user_state'] = array($lang['user_state'], "dropdown", 0, $var, 1, 0, 0, 0);
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Dropdown options for custom database fields
« Reply #10 on: April 28, 2005, 05:56:10 PM »
Hi V@no I did what u told me but with the list of countries and I get this error:

Code: [Select]
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/ascanio/domains/girlsandgirls.
My country list is this:

Code: [Select]
$var = array("Africa",
"Ethiopia",
"Somalia",
"South Africa",
"Other",
"Middle East"'
"Egypt",
"Iran",
"Israel",
"Kuwait",
"Lebanon",
"Morocco",
"Saudi Arabia",
"Syria",
"Turkey",
"U. A. Emirates",
"Other",
"Asia",
"Armenia",
"Bangladesh",
"Cambodia",
"China",
"India",
"Indonesia",
"Japan",
"Malaysia",
"Myanmar",
"Nepal",
"Pakistan",
"Philippines",
"Singapore",
"South Korea",
"Sri Lanka",
"Taiwan",
"Thailand",
"Uzbekistan",
"Vietnam",
"Other",
"Europe",
"Albania",
"Austria",
"Belarus",
"Belgium",
"Bosnia",
"Bulgaria",
"Croatia",
"Cyprus",
"Czech Rep.",
"Denmark",
"Estonia",
"Finland",
"France",
"Germany",
"Greece",
"Hungary",
"Iceland",
"Ireland",
"Italy",
"Latvia",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macedonia",
"Malta",
"Monaco",
"Netherlands",
"Norway",
"Poland",
"Portugal",
"Romania",
"Russia",
"Slovakia",
"Slovenia",
"Spain",
"Sweden",
"Switzerland",
"Ukraine",
"United Kingdom",
"Other",
"Australia",
"Australia",
"New Zealand",
"Other",
"Latin America",
"Costa Rica",
"Cuba",
"El Salvador",
"Guatemala",
"Haiti",
"Jamaica",
"Mexico",
"Panama",
"Other",
"North America",
"Canada",
"USA",
"Other",
"South America",
"Argentina",
"Bolivia",
"Brazil",
"Chile",
"Colombia",
"Ecuador",
"Paraguay",
"Peru",
"Suriname",
"Uruguay",
"Venezuela",
"Other"
);
$additional_user_fields['user_country'] = array($lang['user_country'], "dropdown", 0, $var, 1, 0, 0, 0);


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #11 on: April 29, 2005, 12:16:26 AM »
"Middle East"'
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Warrior

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Lawrence Family History
Re: [MOD] Dropdown options for custom database fields
« Reply #12 on: May 29, 2005, 02:19:27 AM »
Question- Can "members.php" be substituted with "details.php" and "register.php" be substituted with "upload.php"?

What I am wanting to do is require a field from a drop down menu stating which format a zipped or RAR file has in it (meaning is the file a Lightwave file, 3DSMax file, etc) when someone uploads from the upload page *or* when a file is added in the Admin CP.

Then I want those results shown on the detail.php and AdminCP edit pages, etc for the file.

Offline Warrior

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
    • Lawrence Family History
Re: [MOD] Dropdown options for custom database fields
« Reply #13 on: May 29, 2005, 02:53:38 AM »
...hmm Looking this over, do I really need to mod details.php (members.php in yours) if I don't need a drop down on the details.php page in the first place?

The only thing I want there on the details.php is the results from the drop down selection taking place from the uploads, The results on details.php would be given by the db_field_definitions.php code anyways, right?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Dropdown options for custom database fields
« Reply #14 on: May 29, 2005, 07:00:50 AM »
I dont think u need this mod for what u are trying to do, because it doesnt require multilanguage support in the items of the dropdown, so just add your new field in 4images_images table in the database, update db_field_definitions.php with your new field info (use "text" type) and create dropdown menu directly in member_uploadform.html template. that's all.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)