Making registration fields mandatory Making registration fields mandatory
 

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

Main Menu

Making registration fields mandatory

Started by colinmann, July 11, 2006, 02:39:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

colinmann

Hi,

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

Thanks, Colin

Sami

find these lines(222~227) on your register.php

        $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

if (!$profile1) $error .= "<li>it's mandatory to fill in your xxxx";

after

$profile1 = addslashes($_POST['user_profile1']);

now your code should be look like this

        $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']);
‍I don't answer to PM with support question
Please post your issue to related board

colinmann


wuschel_lux

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

sinfin

Perfect, just what I was looking for!!!
Thank you!!

DawL

Quote from: 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


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:

$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:

$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)



DawL

Quote from: DawL on January 20, 2008, 12:29:06 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.