We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Register users with their email address and according to their email address add them to different member groups

Development and Programming

alexwolk's avatar
alexwolk
19 posts
14 years ago
alexwolk's avatar alexwolk

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

       
Kernon's avatar
Kernon
173 posts
14 years ago
Kernon's avatar Kernon

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.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.