[Double posting]: Make Custom Field selectable [Double posting]: Make Custom Field selectable
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[Double posting]: Make Custom Field selectable

Started by digof, October 19, 2008, 05:00:26 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

digof

How Can I make the custom field: "GENDER" that I made, SELECTABLE? So people can only choose one: male/female or man/woman? Not write one of them in the field?
I already made custom fields nr 1, 2 and 3 mandatory as for your instruction:
In admin. mode I created the fields Birthday, Gender and State

In register.php


this Code:
    $form_data = array(
        array('label', $lang_register_php['required_info']),
        array('input', 'username', $lang_register_php['username'], 25),
        array('password', 'password', $lang_register_php['password'], 25),
        array('password', 'password_verification', $lang_register_php['password_again'], 25),
        array('input', 'email', $lang_register_php['email'], 255),
array('label', $lang_register_php['optional_info']),
                array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255),
                array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255),
                array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255),
                array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255),
                array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255),
               array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255)
        );



I Replaced it with:

    $form_data = array(
        array('label', $lang_register_php['required_info']),
        array('input', 'username', $lang_register_php['username'], 25),
        array('password', 'password', $lang_register_php['password'], 25),
        array('password', 'password_verification', $lang_register_php['password_again'], 25),
        array('input', 'email', $lang_register_php['email'], 255),
        array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255),// Added for fullname mandatory Mod
        array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255),// Added for fullname mandatory Mod
        array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255),// Added for fullname mandatory Mod
array('label', $lang_register_php['optional_info']),
//              array('input', 'user_profile1', $CONFIG['user_profile1_name'], 255), // Commented for fullname mandatory Mod
//              array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255), // Commented for fullname mandatory Mod
//              array('input', 'user_profile3', $CONFIG['user_profile3_name'], 255), // Commented for fullname mandatory Mod
                array('input', 'user_profile4', $CONFIG['user_profile4_name'], 255),
                array('input', 'user_profile5', $CONFIG['user_profile5_name'], 255),
               array('textarea', 'user_profile6', $CONFIG['user_profile6_name'], 255)
        );


this code:
    $email = trim(get_post_var('email'));
        $profile1 = addslashes($_POST['user_profile1']);
        $profile2 = addslashes($_POST['user_profile2']);
        $profile3 = addslashes($_POST['user_profile3']);
        $profile4 = addslashes($_POST['user_profile4']);
        $profile5 = addslashes($_POST['user_profile5']);
$profile6 = addslashes($_POST['user_profile6']);


replaced with:

    $email = trim(get_post_var('email'));
    $profile1 = trim(get_post_var('user_profile1')); // Added for fullname mandatory Mod
    $profile2 = trim(get_post_var('user_profile2')); // Added for fullname mandatory Mod
    $profile3 = trim(get_post_var('user_profile3')); // Added for fullname mandatory Mod
//      $profile1 = addslashes($_POST['user_profile1']); // Commented for fullname mandatory Mod
//      $profile2 = addslashes($_POST['user_profile2']); // Commented for fullname mandatory Mod
//      $profile3 = addslashes($_POST['user_profile3']); // Commented for fullname mandatory Mod
        $profile4 = addslashes($_POST['user_profile4']);
        $profile5 = addslashes($_POST['user_profile5']);
$profile6 = addslashes($_POST['user_profile6']);

after this Code:
    if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];

I ADDED this code:
    if (utf_strlen($profile1) < 8 || !eregi("^([0-9]{2})+/+([0-9]{2})+/+[0-9]{4}$",$profile1)) $error .= '<li>' . "Birthday must

be like this-16/09/2000 "; // Added for fullname mandatory Mod
    if (utf_strlen($profile2) < 2) $error .= '<li>' . "Gender"; // Added for fullname mandatory Mod
    if (utf_strlen($profile3) < 2) $error .= '<li>' . "Parents"; // Added for fullname mandatory Mod


replaced this code (second appearance of this code):

                                                        $template_vars = array(
                                                                        '{SITE_NAME}' => $CONFIG['gallery_name'],
                                                                        '{USER_NAME}' => $user_name,
                                                                        '{ACT_LINK}' => $act_link,
        );


with this code:


                                                        $template_vars = array(
                                                                        '{SITE_NAME}' => $CONFIG['gallery_name'],
                                                                        '{USER_NAME}' => $user_name,
                                                                        '{ACT_LINK}' => $act_link,
        '{USER_MAIL}' => $email, // Added for Fullname mandatory Mod
        '{Birthday}' => $profile1, // Added for Fullname mandatory Mod
        '{Gender}' => $profile2, // Added for Fullname mandatory Mod
        '{State}' => $profile3, // Added for Fullname mandatory Mod
                                                        );


And in Lang/english.php

this code:

$lang_register_approve_email = <<<EOT
A new user with the username "{USER_NAME}" has registered in your gallery.

In order to activate the account, you need to click on the link below or copy and paste it in your web browser.

<a href="{ACT_LINK}">{ACT_LINK}</a>

EOT;



Replaced with this

$lang_register_approve_email = <<<EOT
A new user with

the username: {USER_NAME}
E-mail Address {USER_MAIL}
Birthday: {Birthday}
Gender: {Gender}
State: {State}

has registered in your gallery.

In order to activate the account, you need to click on the link below or copy and paste it in your web browser.

<a href="{ACT_LINK}">{ACT_LINK}</a>

EOT;



Everything is working fine but I want people to click on MALE OR FEMALE, instead of writing