I am trying to build a registration form , that take specific email address for example “college.edu”. As I went through documentation, it cannot be done with Expression engine. We have to do it manually. This is what i have done so far.
{global_header_before_title}
<title>{site_name}</title> {embed="embeds/global_header_after_title"}
{exp:simple_registration:form }
E-mail: <input type="text" name="email" />
Confirm E-mail: <input type="text" name="email_confirm"/></p>
Password: <input type="password" name="password"/></p>
Confirm Password: <input type="password" name="password_confirm"/></p>
Submit the word you see below:
{captcha}
<input type="text" name="captcha"></p>
<input type="submit" value="Register account"/></p>
{/exp:simple_registration:form}
{global_footer}
<? php $username = $_POST[‘username’] ;
$email = $_POST['email'] ;
$final = substr($email,stripos($email,'@')+1); // domain.edu found
//$final = strtolower(substr($str,0,stripos($str,'.'))); // domain name found
if ($final=="indiana.edu")
{
// Insert the member according to the group they belong.
$query = $this->EE->db->query("UPDATE exp_members SET group_id = '6' ");
$confirmation_message = "$email is now in the University of Indiana group." ;
redirect('site/blog/comments/student_indiana');
else
{
// if the email already exists
$confirmation_message = "ERROR: " . (($group_id == 6)?"$email is already in the group.") ;
}
?>
If I remove the PHP code the page renders properly but when i add the php code it does not show up. Just a blank page. My sole goal is to register user according to their college and schools and when they login their school page or entries from their school page is redirected.
Can somebody help on this?
Thank you
I don’t see how your PHP section could get the post data (it’s within the same template, and therefore has to execute before the user has entered anything, submitted the form, etc.).
A possible work-around would be to have a pre-registration page where you have the person select their school (or give their email address, which you parse), and then using this information, build the appropriate simple_registration form using “Signup Keys” to specify the appropriate user group. Or, maybe with JavaScript, you could do it all on one page.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.