Stand Alone Member Registration Form in ExpressionEngine

Posted on March 13, 2013

Today, I looked a question over StackExchange for Member registration form without third party plugins/add-ons and I started searching at EllisLab as there was already an existing guidance for Stand Alone Member Registration Form. But after many hits, I couldn’t find.

Although, It can be easily done by understanding the working of existing member registration form of member profile and discussion forum.

Here is the example code:


<?php
$this->EE = & get_instance();
$action_id = $this->EE->functions->fetch_action_id('Member', 'register_member');
$site_id = $this->EE->config->item('site_id');
?>
<form id="member_register_form" method="post" action="{site_url}">

    <input type="hidden" name="XID" value="{XID_HASH}" />

    <input type="hidden" name="ACT" value="<?php echo $action_id; ?>" />

    <input type="hidden" name="RET" value="template_group/template" />

    <input type="hidden" name="site_id" value="<?php echo $site_id; ?>" />

    <p>Username: <input type="text" name="username" id="username" value="" /></p>

    <p>Password: <input type="password" name="password" id="password" value="" /></p>

    <p>Confirm Password: <input type="password" name="password_confirm" id="password_confirm" value="" /></p>

    <p>Screen Name: <input type="text" name="screen_name" id="screen_name" value="" /></p>

    <p>Email: <input type="text" name="email" id="email" value="" /></p>

    <p>Confirm Email: <input type="text" name="email_confirm" id="email_confirm" value="" /></p>

    <p>URL: <input type="text" name="url" id="url" value="" /></p>

    <p>Location: <input type="text" name="location" id="location" value="" /></p>

    <p>Occupation: <input type="text" name="occupation" id="occupation" value="" /></p>

    <p>Interests: <input type="text" name="interests" id="interests" value="" /></p>

    <p>Member custom field 1(having id as 1): <input type="text" name="m_field_id_1" id="m_field_id_1" value="" /></p>

    <p>Member custom field 2(having id as 2): <input type="text" name="m_field_id_2" id="m_field_id_2" value="" /></p>

    <p><input type="checkbox" value="y" name="accept_terms" /> Agree to the terms of service</p>

    <p><input type="submit" value="Submit" class="submit" /></p>

</form>

You can see that above code example is having PHP code so you need to allow PHP from template’s preferences.

For the empty field’s validation, jQuery validation plugin would be fine.

Although, I always prefer to use third-party add-on because of having more flexibility. So it’s your choice having this approach ;).

Please Note: I tested this stand alone member registration form at EE v2.5.3+ so I couldn’t guarantee for the lower versions of ExpressionEngine.