Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: [Double posting]: Make Custom Field selectable  (Read 2605 times)

0 Members and 1 Guest are viewing this topic.

digof

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
[Double posting]: Make Custom Field selectable
« on: October 19, 2008, 05:00:26 am »

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:
Code: [Select]
    $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:

Code: [Select]
    $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:
Code: [Select]
    $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:

Code: [Select]
    $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:
Code: [Select]
    if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];
I ADDED this code:
Code: [Select]
    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):

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

with this code:


Code: [Select]
                                                        $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:

Code: [Select]
$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

Code: [Select]
$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
« Last Edit: October 19, 2008, 02:47:19 pm by Joachim Müller »
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.