Page 1 of 1
[SOLVED] SelfRegistration: Field must have a certain value
Posted: Wed Aug 03, 2011 12:26 pm
by opawaldburger
Hi there!
I'm currently building a website for a small community with about 50 members. Those members shall be able to register themselves for the restricted area, therefore I use FEU and SelfRegistration.
Of course I only want members of the community to be able to register. So I thought, the best idea would be to have a field, where a specific value has to be entered, to proceed the registration. For example a field called "Enter Code", and the value has to be "135join-in".
How can I do this?
Regards, opa
Re: SelfRegistration: Field must have a certain value
Posted: Wed Aug 03, 2011 1:29 pm
by Duketown
opa,
Maybe you can use some (or all of the following):
http://forum.cmsmadesimple.org/viewtopi ... 28&t=55014
Duketown
Re: SelfRegistration: Field must have a certain value
Posted: Thu Aug 04, 2011 5:48 pm
by opawaldburger
Hi Duketown!
Thanks a lot for your post, but I'm afraid this doesn't help me a lot. At least a have no idea how to implement this into SelfRegistration...
-opa
Re: SelfRegistration: Field must have a certain value
Posted: Fri Aug 05, 2011 5:27 am
by Duketown
opa,
Once I had reread it, I can imagine it is not the easiest one to understand.
Please copy the following to your registration page:
Code: Select all
// Use {CodeProtectedSelfRegistration} in one of your pages
// UDT based upon idea from steelexus
// How to prepare UDT in UDT was taken from wiki documentation of CMSMS
$passprot = '135join-in'; // The code that should be entered
$pass = $_POST[pass];
if ($pass)
{
if ($pass==$passprot)
{
$_SESSION[passprot] = $passprot;
// Prepare tag to self registration
$gCms = cmsms(); //global $gCms;
$smarty = &$gCms->GetSmarty();
$smarty_data = "{cms_module module=SelfRegistration}";
$smarty->_compile_source('temporary template',
$smarty_data, $_compiled );
@ob_start();
$smarty->_eval('?>' . $_compiled);
$_contents = @ob_get_contents();
@ob_end_clean();
echo $_contents;
}
else
{
echo 'Wrong code.';
}
}
else
{
echo '
<form method=post>
Enter code: <INPUT TYPE="PASSWORD" NAME="pass" VALUE="'.$pass.'">
<INPUT TYPE="SUBMIT" VALUE="OK">
</FORM>
';
}
You will first only see the field where the code should be entered. Next you will see the registration form of SelfRegistration.
Duketown
Re: SelfRegistration: Field must have a certain value
Posted: Fri Aug 05, 2011 12:55 pm
by opawaldburger
This. is. great!!!
Thanks a lot, it's working fantastic!!!

Re: SelfRegistration: Field must have a certain value
Posted: Fri Aug 05, 2011 2:38 pm
by Duketown
Good to hear/read that it works in one go.
Please put [Solved] in the header of this post.
Duketown
Re: [SOLVED] SelfRegistration: Field must have a certain val
Posted: Thu Nov 03, 2011 6:56 am
by allan1412
Hi Duketown
Thanks for providing this method of hiding the SelfRegistration form.
Does it need modification for 1.10?
The SelfReg form works as expected when not 'within' the hidden content - but although the form is shown as expected when using the udt/passcode form - completing the form does not submit its content.
Thanks
Allan
Re: [SOLVED] SelfRegistration: Field must have a certain val
Posted: Thu Nov 10, 2011 10:03 am
by georgechr
that would be nice