1
Kellymac
Remove elements of user registration
  • 2006/10/18 16:24

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


I'm trying to be able to remove the radio button field of the user registration and would like that the user will default to agree to recive mail.

I'm pretty sure something needs to be changed in two places. But, not sure how.

in include/registerform.php :

<input type='hidden' name='name' value='".$myts->makeTboxData4PreviewInForm($name)."' />, $user_mailok));
if ($xoopsConfigUser['reg_dispdsclmr'] != 0 && $xoopsConfigUser['reg_disclaimer'] != '') {
$disc_tray = new XoopsFormElementTray(_US_DISCLAIMER, '<br />');
$disc_text = new XoopsFormTextarea('', 'disclaimer', $xoopsConfigUser['reg_disclaimer'], 8);
$disc_text->setExtra('readonly="readonly"');
$disc_tray->addElement($disc_text);
$agree_chk = new XoopsFormCheckBox('', 'agree_disc', $agree_disc);
$agree_chk->addOption(1, _US_IAGREE);
$disc_tray->addElement($agree_chk);
$reg_form->addElement($disc_tray);
}



In register.php :

<input type='hidden' name='user_mailok' value='".$user_mailok."' />
<br /><br /><input type='hidden' name='op' value='finish' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."<input type='submit' value='". _US_FINISH ."' /></form>";
} else {
echo "<span style='color:#ff0000;'>$stop</span>";
include 'include/registerform.php';
$reg_form->display();
}

2
m0nty
Re: Remove elements of user registration
  • 2006/10/18 18:05

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


change (in register.php)

$user_mailok = (isset($_POST['user_mailok']) && intval($_POST['user_mailok'])) ? 0 : 1;

to

$user_mailok = (isset($_POST['user_mailok']) && intval($_POST['user_mailok'])) ? 1 : 0;

that will make it default to yes on the form.

if you want to make it permanently select yes and remove the field. then change (in register.php)

$newuser->setVar('user_mailok',$user_mailok, true);

to

$newuser->setVar('user_mailok', 1, true);

you don't have to remove the field then. but if you want to remove the field anyway then change (in include/registerform.php)

$reg_form->addElement(new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $user_mailok));

to

// $reg_form->addElement(new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $user_mailok));

3
Kellymac
Re: Remove elements of user registration
  • 2006/10/19 16:52

  • Kellymac

  • Just popping in

  • Posts: 41

  • Since: 2006/2/1 1


That did it! You rock!