1
antifmradio
Manditory fields for user registration?

Wanted to know if there is a way to make some of the fields MANDITORY for user registrations.

2
Anonymous
Re: Manditory fields for user registration?
  • 2008/5/29 0:10

  • Anonymous

  • Posts: 0

  • Since: 0


use smartprofile module or you need to hack register.php file.

For example: How to make Name field as required ?

Edit register.php then add:
$name = isset($_POST['name']) ? $myts->stripSlashesGPC($_POST['name']) : '';
before:
$uname = isset($_POST['uname']) ? $myts->stripSlashesGPC($_POST['uname']) : '';
and add:
<input type='hidden' name='name' value='".$myts->htmlSpecialChars($name) ."' />
before:
<input type='hidden' name='uname' value='".$myts->htmlSpecialChars($uname)."' />
and add:
$newuser->setVar('name', $name, true);
before:
$newuser->setVar('uname', $uname, true);

Now edit include/registerform.php then add:
$reg_form->addElement(new XoopsFormText(_US_REALNAME, 'name', 30, 60, $myts->htmlSpecialChars($name)), true);
before:
$uname_size = $xoopsConfigUser['maxuname'] < 25 ? $xoopsConfigUser['maxuname'] : 25;

That's it!

This hack based on autologin hack and working on 2.0.18.1 or older.