Advanced search  

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

Pages: [1]   Go Down

Author Topic: Mandatory user fields  (Read 5056 times)

0 Members and 1 Guest are viewing this topic.

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Mandatory user fields
« on: December 07, 2004, 11:59:27 am »

If mandatory means "must be filled in" then i've chosen the right word.

Have searched the board but with no satisfying result :(

Is is possible to alter the registration proces of new users so that they have to fill in certain fields.
And if they do not that the registration can not take place.

Or someone tells me i should upgrade my search skills  ;D and points me in the right direction. For which i thank you in advance  ;)
Logged

Nibbler

  • Guest
Re: Mandatory user fields
« Reply #1 on: December 07, 2004, 12:18:01 pm »

Just add a line into register.php:

under
Code: [Select]
$occupation = addslashes(get_post_var('occupation'));
add
Code: [Select]
if (!$occupation) $error .= "<li>You must fill in your occupation!";
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Mandatory user fields
« Reply #2 on: December 07, 2004, 01:38:56 pm »

You could as well spice this up with some JavaScript to prompt the user to fill in the mandatory fields even before (when he tries to submit the form). Edit register.php, find
Code: [Select]
    starttable(-1, $lang_register_php['enter_info'], 2);
    echo <<<EOT
        <form method="post" action="$PHP_SELF">
and replace with
Code: [Select]
    starttable(-1, $lang_register_php['enter_info'], 2);
    echo <<<EOT
<script type="text/javascript">
<!--
    function chkForm()
    {
     if(document.myform.user_profile1.value == "")
      {
       alert("Please fill in FOOBAR");
       document.myform.user_profile1.focus();
       return false;
      }

     if(document.myform.user_profile2.value == "")
      {
       alert("Some other alert text to tell the user he is behaving naughty!");
       document.myform.user_profile2.focus();
       return false;
      }
}
-->
</script>
        <form method="post" action="$PHP_SELF" name="myform" onsubmit="return chkForm();">
(From the back of my head, not tested though).
Users who disabled JavaScript will not see the prompt - to make this foolproof, you'll have to check as suggested by Nibbler anyway.

Joachim
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: Mandatory user fields
« Reply #3 on: December 07, 2004, 02:12:46 pm »

Thanks for the tips. Will try at home.

Going to use this on a gallery which requires users to register with their scouting membership number.

I assume there is also a way to have a javascript check on what sort of input has been given into
a field ? For example if all characters are numbers and also check the amount of numbers.
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Mandatory user fields
« Reply #4 on: December 07, 2004, 02:17:24 pm »

This was also discussed on this post, which may have an extra tip for you  ;)

http://forum.coppermine-gallery.net/index.php?topic=11946.msg54168#msg54168
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: Mandatory user fields
« Reply #5 on: December 07, 2004, 03:42:53 pm »

Thanks Casper ;)

*makes mental note profile fields = user fields

But thanks for the information so far!
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.