Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: More Registration fields needed.  (Read 6607 times)

0 Members and 1 Guest are viewing this topic.

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
More Registration fields needed.
« on: March 13, 2011, 10:31:30 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15394
Re: More Registration fields needed.
« Reply #1 on: March 14, 2011, 12:27:41 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


http://www.empireballroom.ca/Coppermine/register.php
Quote
<!--Coppermine Photo Gallery 1.5.8 (stable)-->
You should upgrade to cpg1.5.12 immediately.
Logged

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #2 on: March 15, 2011, 03:11:55 am »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15394
Re: More Registration fields needed.
« Reply #3 on: March 15, 2011, 08:41:42 am »

What's wrong with the solution I already posted?
Logged

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #4 on: March 15, 2011, 07:06:37 pm »

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!!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15394
Re: More Registration fields needed.
« Reply #5 on: March 18, 2011, 03:09:52 pm »

To make all user defined required, open register.php, comment out/delete
Code: [Select]
array('label', $lang_register_php['optional_info'])and
Code: [Select]
$form_data = array_slice($form_data, 0, count($form_data)-1);
find
Code: [Select]
    $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
Code: [Select]
    $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
Code: [Select]
            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
Code: [Select]
            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
Code: [Select]
        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
Code: [Select]
        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
Code: [Select]
    if (errors != 0) {
        $('#form_not_submit_top').show();
        $('#form_not_submit_bottom').show();
        return false;
    } else {
        return true;
    }
above, add
Code: [Select]
    // 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++;
    }
Logged

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #6 on: March 18, 2011, 08:59:38 pm »

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

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #7 on: March 18, 2011, 09:11:17 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15394
Re: More Registration fields needed.
« Reply #8 on: March 18, 2011, 10:54:58 pm »

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

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #9 on: March 19, 2011, 12:33:56 am »

Thank you for all your help!
Logged

travelbuff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: More Registration fields needed.
« Reply #10 on: March 23, 2011, 12:21:20 am »

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
Logged

crazysved

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: More Registration fields needed.
« Reply #11 on: March 23, 2011, 06:58:48 am »

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

/**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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15394
Re: More Registration fields needed.
« Reply #12 on: March 23, 2011, 09:45:37 am »

Just delete that lines or comment them out as described in the PHP docs: http://php.net/manual/en/language.basic-syntax.comments.php
Logged

travelbuff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: More Registration fields needed.
« Reply #13 on: March 29, 2011, 01:05:37 am »

Thanks, that worked!
Logged

travelbuff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: More Registration fields needed.
« Reply #14 on: April 05, 2017, 01:56:42 am »

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
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 685
Logged

travelbuff

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: More Registration fields needed.
« Reply #16 on: April 05, 2017, 11:38:42 pm »

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

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 685
Re: More Registration fields needed.
« Reply #17 on: April 06, 2017, 05:28:29 am »

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.
« Last Edit: April 06, 2017, 05:37:23 am by ron4mac »
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 21 queries.