More Registration fields needed. More Registration fields needed.
 

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

More Registration fields needed.

Started by crazysved, March 13, 2011, 10:31:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

crazysved

hello, when a user registers on my photo gallery i need the optional registration fields to be required (first name, last name, bday). is there an easy way to fix this? thank you.
http://www.empireballroom.ca/Coppermine/register.php

Αndré

Quote from: crazysved on March 13, 2011, 10:31:30 PM
when a user registers on my photo gallery i need the optional registration fields to be required (first name, last name, bday).
http://forum.coppermine-gallery.net/index.php/topic,70390.0.html


Quote from: crazysved on March 13, 2011, 10:31:30 PM
http://www.empireballroom.ca/Coppermine/register.php
Quote<!--Coppermine Photo Gallery 1.5.8 (stable)-->
You should upgrade to cpg1.5.12 immediately.

crazysved

i have upgraded from 1.5.8 - 1.5.12, i still need help!

Αndré


crazysved

Sorry i didnt see your link André, i read through it but am confused as to how i edit the code. could you help me with it please? i need my registration form to look like this..
Input registration information    
Required information  
User Name
Email
Password   
Re-enter password   
First Name   
Last Name   
Birthday

Im not very good with the code side of things. Thanks for all your help so far! It is appreciated!!

Αndré

To make all user defined required, open register.php, comment out/delete
array('label', $lang_register_php['optional_info'])
and
$form_data = array_slice($form_data, 0, count($form_data)-1);

find
    $profile1 = $superCage->post->getEscaped('user_profile1');
    $profile2 = $superCage->post->getEscaped('user_profile2');
    $profile3 = $superCage->post->getEscaped('user_profile3');
    $profile4 = $superCage->post->getEscaped('user_profile4');
    $profile5 = $superCage->post->getEscaped('user_profile5');
    $profile6 = $superCage->post->getEscaped('user_profile6');
    $agree_disclaimer = $superCage->post->getEscaped('agree');

and replace with
    $profile1 = $CONFIG['user_profile1_name'] != '' ? trim(get_post_var('user_profile1')) : $superCage->post->getEscaped('user_profile1');
    $profile2 = $CONFIG['user_profile2_name'] != '' ? trim(get_post_var('user_profile2')) : $superCage->post->getEscaped('user_profile2');
    $profile3 = $CONFIG['user_profile3_name'] != '' ? trim(get_post_var('user_profile3')) : $superCage->post->getEscaped('user_profile3');
    $profile4 = $CONFIG['user_profile4_name'] != '' ? trim(get_post_var('user_profile4')) : $superCage->post->getEscaped('user_profile4');
    $profile5 = $CONFIG['user_profile5_name'] != '' ? trim(get_post_var('user_profile5')) : $superCage->post->getEscaped('user_profile5');
    $profile6 = $CONFIG['user_profile6_name'] != '' ? trim(get_post_var('user_profile6')) : $superCage->post->getEscaped('user_profile6');



If you want to show an error message before the form will be submitted, open register.php, find
            if (isset($lang_register_php[$element[1].'_warning2']) == TRUE) {
                $warning2 = '<div id="'.$element[1].'_warning2" class="cpg_message_validation formFieldWarning" style="display:none;">' . $lang_register_php[$element[1].'_warning2'] . '</div>';
            } else {
                $warning2 = '';
            }

below, add
            if ($element[1] == 'user_profile1') {
                $warning1 = '<div id="user_profile1_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile1_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }
           
            if ($element[1] == 'user_profile2') {
                $warning1 = '<div id="user_profile2_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile2_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }
           
            if ($element[1] == 'user_profile3') {
                $warning1 = '<div id="user_profile3_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile3_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }
           
            if ($element[1] == 'user_profile4') {
                $warning1 = '<div id="user_profile4_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile4_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }
           
            if ($element[1] == 'user_profile5') {
                $warning1 = '<div id="user_profile5_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile5_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }


find
        case 'textarea':

            if ($superCage->post->keyExists($element[1])) {
                $value = $superCage->post->getEscaped($element[1]);
            } else {
                $value = '';
            }
             
            if ($element[2]) {
           
                echo <<< EOT
    <tr>
        <td width="40%" class="{$row_style}">
            {$element[2]}
        </td>
        <td width="60%" class="{$row_style}" valign="top">
            <textarea name="{$element[1]}" rows="7" cols="60" class="textinput" style="width:100%">$value</textarea>
        </td>
    </tr>


EOT;
            }
            break;

and replace with
        case 'textarea':

            if ($superCage->post->keyExists($element[1])) {
                $value = $superCage->post->getEscaped($element[1]);
            } else {
                $value = '';
            }
           
            if ($element[1] == 'user_profile6') {
                $warning1 = '<div id="user_profile6_warning1" class="cpg_message_validation formFieldWarning" style="display:none;">';
                $warning1 .= 'The ' . $CONFIG['user_profile6_name'] . ' mustn\'t be empty!';
                $warning1 .= '</div>';
                $warning2 = '';
            }
           
            if ($element[2]) {
           
                echo <<< EOT
    <tr>
        <td width="40%" class="{$row_style}">
            {$element[2]}
        </td>
        <td width="60%" class="{$row_style}" valign="top">
            <textarea name="{$element[1]}" id="{$element[1]}" rows="7" cols="60" class="textinput" style="width:100%">$value</textarea>
            {$warning1}
            {$warning2}
        </td>
    </tr>


EOT;
            }
            break;


open js/register.js, find
    if (errors != 0) {
        $('#form_not_submit_top').show();
        $('#form_not_submit_bottom').show();
        return false;
    } else {
        return true;
    }

above, add
    // Check user_profile1
    if($('#user_profile1').val() == '') {
        $('#user_profile1_warning1').show();
        errors++;
    }
    // Check user_profile2
    if($('#user_profile2').val() == '') {
        $('#user_profile2_warning1').show();
        errors++;
    }
    // Check user_profile3
    if($('#user_profile3').val() == '') {
        $('#user_profile3_warning1').show();
        errors++;
    }
    // Check user_profile4
    if($('#user_profile4').val() == '') {
        $('#user_profile4_warning1').show();
        errors++;
    }
    // Check user_profile5
    if($('#user_profile5').val() == '') {
        $('#user_profile5_warning1').show();
        errors++;
    }
    // Check user_profile6
    if($('#user_profile6').val() == '') {
        $('#user_profile6_warning1').show();
        errors++;
    }

crazysved

 Thank you so much Αndré! everything works just the way i wanted. :)

crazysved

maybe one more thing, i tried to find in the login.php where i can change the wording from "Enter your username and password to login" to "Enter your email and password to login" but couldnt find it. some users are getting confused by this. could you help me out with this aswell please and thanks?
http://www.empireballroom.ca/Coppermine/login.php

Αndré

It's in the language file lang/english.php.

crazysved


travelbuff

Andre
Can you explain what you mean on the first step, Comment out/delete?  Do I delete those first to lines you have at the beginning?

Thanks

crazysved

the way i did it was found the lines of code he was talking about and surrounded them with /** **/ to comment them out.
like so

/**array('label', $lang_register_php['optional_info'])**/
/**$form_data = array_slice($form_data, 0, count($form_data)-1);**/

you can either do that or remove them entirely

to find lines of code on my windows pc in dreamweaver i held down ctrl and pressed f then copied the original lines of code into the find box and pressed find next or find all, that should let you find the lines of code.
hope it works for you too.

Αndré


travelbuff


travelbuff

Hello

I tried to enter the code for the mandatory fields below and apparently I did something wrong so I backed out all the code but now when I try to register I get this error; PHP Parse error: syntax error, unexpected ' ' (T_STRING) in register.php on line 211

Here is what I have on 211              if (isset($lang_register_php[$element[1].'_warning2']) == TRUE) {

What did I not copy and paste correctly.  I do not see anything.

Thanks


travelbuff

Thanks for the link, is the correct register.php code?

ron4mac

#17
Don't know your version.  Find it here:  https://sourceforge.net/p/coppermine/code/HEAD/tree/tags

Though, it looks more like an issue with whatever you are using for an editor inserting bad (as far as PHP is concerned) characters.