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
			
			
			
				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.
			
 
			
			
				i have upgraded from 1.5.8 - 1.5.12, i still need help!
			
			
			
				What's wrong with the solution I already posted (http://forum.coppermine-gallery.net/index.php/topic,70390.msg344756.html#msg344756)?
			
			
			
				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!!
			
			
			
				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++;
    }
			
			
			
				 Thank you so much Αndré! everything works just the way i wanted. :)
			
			
			
				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
			
			
			
				It's in the language file lang/english.php.
			
			
			
				Thank you for all your help!
			
			
			
				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
			
			
			
				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.
			
			
			
				Just delete that lines or comment them out as described in the PHP docs: http://php.net/manual/en/language.basic-syntax.comments.php
			
			
			
				Thanks, that worked!
			
			
			
				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
			
			
			
				https://sourceforge.net/p/coppermine/code/HEAD/tree/trunk/cpg1.5.x/register.php
			
			
			
				Thanks for the link, is the correct register.php code?
			
			
			
				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.