2004-09-26 12:34:21
How to limit registration of new students
I wanted to be able to limit new registrations to prevent just anyone from being able to register. Maybe this 'add-on' will help others in my situation in limiting registration. I already had a 'nuke' program where registration had to be pre-approved and membership is paid. (cpgnuke). I wanted only my cpgnuke members to be able to register on my ATutor program. This is what I did. (You can adjust it to fit your needs).
If you are using a 'Nuke' program -
1. add a 'Content' page that can only be viewed by members. In cpgnuke this is a module called 'Content'. My 'Content' module is restricted to members only, so only members can view pages in my content module. It might be different in other nuke programs but just add a page or news article that can only be viewed by members.
2. Include the ATutor Registration 'Form' into your page.. Make sure to change the part in red to reflect where your ATutor program is located on your server. Here is the Registration Form:
<form method="post" action="http://[red]yourwebsite.com[/red]
/ATutor/registration.php" name="form">
<h3>Registration</h3><br />
<table cellspacing="1" cellpadding="0" border="0" align="center" summary="">
<tr>
<td class="public-row2" colspan="2"><h4>Account Information (Required)</h4></td>
</tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="login"><strong>Login Name:</strong></label></td>
<td class="public-row" align="left"><input id="login" class="formfield" name="login" type="text" maxlength="20" size="15" value="" /><br />
<small>· May contain only letters, numbers, or underscores.<br />
· 20 character maximum</small></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="password"><strong>Password:</strong></label></td>
<td class="public-row" align="left"><input id="password" class="formfield" name="password" type="password" size="15" maxlength="15" value="" /><br />
<small>· Use a combination of letters, numbers and symbols<br />
· 15 characters maximum</small></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="password2"><strong>Password Again:</strong></label></td>
<td class="public-row" align="left"><input id="password2" class="formfield" name="password2" type="password" size="15" maxlength="15" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="email"><strong>Email Address:</strong></label></td>
<td class="public-row" align="left"><input id="email" class="formfield" name="email" type="text" size="30" maxlength="60" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="langs"><strong>Language:</strong></label></td>
<td class="public-row" align="left"><select name="lang" id="langs">
<option value="en" selected="selected">English</option>
</select><br /><br /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row2" colspan="2"><h4>Personal Information (Optional) </h4></td>
</tr>
<tr>
<td class="public-row" align="right" colspan="2"><input type="checkbox" name="pref" value="access" id="access" /><label for="access">Enable Default Accessibility Preference Settings</label></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="first_name"><strong>First Name:</strong></label></td>
<td class="public-row" align="left"><input id="first_name" class="formfield" name="first_name" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="last_name"><strong>Last Name:</strong></label></td>
<td class="public-row" align="left"><input id="last_name" class="formfield" name="last_name" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><strong>Date of birth:</strong></td>
<td class="public-row""><label for="year">Year: </label><input id="year" class="formfield" name="year" type="text" size="4" maxlength="4" value="" /> <label for="month">Month: </label><input id="month" class="formfield" name="month" type="text" size="2" maxlength="2" value="" /> <label for="day">Day: </label><input id="day" class="formfield" name="day" type="text" size="2" maxlength="2" value="" />
</td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><strong>Sex:</strong></td>
<td class="public-row" align="left"><input type="radio" name="gender" id="m" value="m" /><label for="m">Male</label> <input type="radio" value="f" name="gender" id="f" /><label for="f">Female</label> <input type="radio" value="ns" name="gender" id="ns" checked="checked" /><label for="ns">Not specified</label></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="address"><strong>Street Address:</strong></label></td>
<td class="public-row" align="left"><input id="address" class="formfield" name="address" size="40" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="postal"><strong>Postal/Zip Code:</strong></label></td>
<td class="public-row" align="left"><input id="postal" class="formfield" name="postal" size="7" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="city"><strong>City:</strong></label></td>
<td class="public-row" align="left"><input id="city" class="formfield" name="city" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="province"><strong>Province/State:</strong></label></td>
<td class="public-row" align="left"><input id="province" class="formfield" name="province" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right"><label for="country"><strong>Country:</strong></label></td>
<td class="public-row" align="left"><input id="country" class="formfield" name="country" type="text" value="" /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="phone"><strong>Area Code and Phone Number:</strong></label></td>
<td class="public-row" align="left"><input class="formfield" size="11" name="phone" type="text" value="" id="phone" /> <small>123-456-7890</small></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" align="right" valign="top"><label for="website"><strong>Web Site:</strong></label></td>
<td class="public-row" align="left"><input id="website" class="formfield" name="website" size="40" type="text" value="http://" /><br /><br /></td>
</tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr><td height="1" class="public-row" colspan="2"></td></tr>
<tr>
<td class="public-row" colspan="2" align="center"><input type="submit" class="button" value=" Submit" name="submit" /> - <input type="submit" name="cancel" class="button" value=" Cancel " /></td>
</tr>
</table>
</form>
3. Open the registration.tmlp found in ATutor/templates/
in a text editor like Notepad. Between the lines:
'<?php require(AT_INCLUDE_PATH.'header.inc.php'); ?>' and '<?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>'
delete all of the <form> stuff. It should now just have the above 2 lines in it.
Between the two lines write something like "Only members of my website can register for our classes. If you are a member and wish to register for our classes <a href=http://[red]yourwebsite.com/yourcontentpagewithform[/red]>Click Here</a>"
Since the above link you provided for registration is only accessable to your members than only members will be allowed to see the registration page and sign-up.
IF YOU DO NOT HAVE A NUKE PROGRAM.
1. Create a password protected page with the above form as the content. Give only your members the password to the page with the form. Follow the last step of changing registration.tmpl and include the link to your password protected page.
To see this in action you can visit my site. The ATutor program is here:
http://art-epiphany.com/ATutor/
Click 'Register' and view what the end result of these changes are.
Hope this helps!
Holly:)