1
nickpope
Make real name a required field for user registration
  • 2004/10/24 1:27

  • nickpope

  • Just popping in

  • Posts: 20

  • Since: 2004/10/15


I would like to make 'real name' a required field for user registration.

I have taken a look at register.php and userinfo.php and my head is spinning.

I know squat about php but have made some smaller changes by trial and error. This one has really got me stumped though and I'd appreciate a push in the right direction.

Thanks!

2
CiberEspia
Re: Make real name a required field for user registration

In include/registerform.php ,aprox line 31-36 insert:
$user_from =isset($HTTP_POST_VARS['name']) ?$myts->makeTboxData4PreviewInForm($HTTP_POST_VARS['name']) :"";

now lines 39 - 45 insert:
$name_text=new XoopsFormText (_US_REALNAME"name"26100,$name);


Text Box in lines 75-90:
$reg_form->addElement($name_text); // insert name

something thus:
Quote:
$reg_form = new XoopsThemeForm(_US_USERREG, "userinfo", "register.php");
$reg_form->addElement(new XoopsFormText(_US_NICKNAME, "uname", 26, 25, $uname), true);
$reg_form->addElement($name_text); // insert name

for obligatory field insert( about line 105-106 ):
$reg_form->setRequired($name_text);

NOW register.php:
lines 131 - 135 insert:
echo _US_REALNAME.":".$myts->makeTboxData4Preview($name)."";    //real name

lines 156 - 162
<input type='hidden' name='name'value='".$myts->makeTboxData4PreviewInForm($name)."'/>

Lines 190 -195 :
$newuser->setVar('name'$name);

finish
see a demo: http://www.bierhausperu.com/register.php

saludos y espero sea de utilidad!

3
nickpope
Re: Make real name a required field for user registration
  • 2004/10/24 21:45

  • nickpope

  • Just popping in

  • Posts: 20

  • Since: 2004/10/15




Great! It works! Thank you very much!

4
CiberEspia
Re:Make real name a required field for user registration


5
coopersita
Re:Make real name a required field for user registration

How do you add more than one required field?

I tried
$reg_form->setRequired($lname_text$name_text$email_text);


But it only makes the first one ($lname_text) required, the others are not. Email sort of works because once you submit it checks it for formatting, but name won't work at all.

I also tried
$reg_form->setRequired($lname_text);
$reg_form->setRequired($name_text);
$reg_form->setRequired($email_text);


This just breaks the page (blank page)

Any suggestions?

Here's how I added the fields:
$name = isset($HTTP_POST_VARS['name']) ? $myts->makeTboxData4PreviewInForm($HTTP_POST_VARS['name']) : "";
$name_text = new XoopsFormText(_US_NAME"name"2560$name); 
$lname = isset($HTTP_POST_VARS['lname']) ? $myts->makeTboxData4PreviewInForm($HTTP_POST_VARS['lname']) : "";
$lname_text = new XoopsFormText(_US_LNAME"lname"2560$lname);
....
$reg_form->addElement($name_text);
$reg_form->addElement($lname_text);

6
Mithrandir
Re:Make real name a required field for user registration

$reg_form->addElement($name_text);
$reg_form->addElement($lname_text);


Add a second parameter, true, to those fields
$reg_form->addElement($name_texttrue);
$reg_form->addElement($lname_texttrue);

7
tl
Re: Make real name a required field for user registration
  • 2004/10/28 19:59

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


Mario:
Hope you don't mind of my posting your tip on XOOPS Tips.
http://xoops-tips.com/modules/news/article.php?storyid=59
Thanks.
tl

8
coopersita
Re: Make real name a required field for user registration

Worked like a charm. Thanks.

9
sgshell
Re: Make real name a required field for user registration
  • 2004/11/10 23:05

  • sgshell

  • Just popping in

  • Posts: 94

  • Since: 2004/10/4


How to add a drop down option for field in the register?

Example:country which have list of USA, Canada, Japan, and etc...

thanks

10
cydud3
Re: Make real name a required field for user registration
  • 2004/11/26 8:20

  • cydud3

  • Just popping in

  • Posts: 50

  • Since: 2004/6/10


I almost got this thing working. How do you make it so that the real name also shows up on the User activation key notification sent to webmasters (when activation type is set to 'activation by administrator').

Please can somebody answer this and I will be all set.

Login

Who's Online

418 user(s) are online (294 user(s) are browsing Support Forums)


Members: 0


Guests: 418


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits