forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: colinmann on July 11, 2006, 02:39:43 pm

Title: Making registration fields mandatory
Post by: colinmann on July 11, 2006, 02:39:43 pm
Hi,

Is it possible to make registration fields mandatory? For example - the "Profile 1" entry?

Thanks, Colin
Title: Re: Making registration fields mandatory
Post by: Sami on July 11, 2006, 02:50:26 pm
find these lines(222~227) on your register.php
Code: [Select]
        $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']);
let's see if you want to make profile1 mandatory
add a
Code: [Select]
if (!$profile1) $error .= "<li>it's mandatory to fill in your xxxx";
after
Code: [Select]
$profile1 = addslashes($_POST['user_profile1']);
now your code should be look like this
Code: [Select]
        $profile1 = addslashes($_POST['user_profile1']);
        if (!$profile1) $error .= "<li>it's mandatry to fill in your xxxx";
        $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']);
Title: Re: Making registration fields mandatory
Post by: colinmann on July 11, 2006, 02:59:50 pm
Great, thanks very much!
Title: Re: Making registration fields mandatory
Post by: wuschel_lux on February 14, 2007, 08:30:40 am
Thanks Sami for this post. It works fine but I have a small design problem.

The line 'Optional information' ist still above the aditional fields, but the first four are now mandatory. How can I move this line?

http://www.volleyball.lu/fotogallery/register.php

Thanks
Title: Re: Making registration fields mandatory
Post by: sinfin on January 17, 2008, 01:11:29 am
Perfect, just what I was looking for!!!
Thank you!!
Title: Re: Making registration fields mandatory
Post by: DawL on January 20, 2008, 12:29:06 am
Thanks Sami for this post. It works fine but I have a small design problem.

The line 'Optional information' ist still above the aditional fields, but the first four are now mandatory. How can I move this line?

http://www.volleyball.lu/fotogallery/register.php

Thanks


I realize this is old, but since it went unanswered, I thought I'd share this. This is how I changed mine. (Coppermine Photo Gallery 1.4.14 (stable))


In the same file (register.php) find this section:

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)

Simply move the option profle lines you have made to be required ABOVE the line that says "array('label', $lang_register_php['optional_info'])," like this:

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),
        array('input', 'user_profile2', $CONFIG['user_profile2_name'], 255),
        array('label', $lang_register_php['optional_info']),
                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)

For mine, I required the first two fields (profile1 and profile2) to both be filled in, so I moved both of them. It displayed correctly in IE6 and FF2.0.0.11.
My Galleries reside at:

http://coh.iswiz.com/gallery
(related to an online MMORPG I play)
and
http://dee.iswiz.com/gallery
(My private gallery)


Title: Re: Making registration fields mandatory
Post by: DawL on January 20, 2008, 12:37:58 am
....snipped....

My Galleries reside at:

http://coh.iswiz.com/gallery
(related to an online MMORPG I play)
and
http://dee.iswiz.com/gallery
(My private gallery)


As an added note: the PRIVATE gallery contains some artistic nudes. The CoH gallery does not. I thought I'd better add that warning. The CoH gallery is the one with all the field edits.