Visitor Documentation

Member registration — Zoo Visitor documentation

Member registration

{if last_segment == "success"}

        Account created. You can <a href="{path=visitor_example/login}">login</a> now. Depending on your member activation settings you will receive an email to confirm your registration.

{if:elseif logged_in}

        You are already registered and logged in. <a href="{path=logout}">Logout</a> or go to your <a href="{path=visitor_example/profile}">profile</a>.

{if:else}

        {exp:visitor:registration_form return='visitor_example/register/success'}

        <h3>Register</h3>
        <fieldset>
                <h4>Extra fields</h4>

                <p>
                        <label for="member_firstname">{label:member_firstname}:</label>
                        <input type="text" name="member_firstname" id="member_firstname" value="{if member_firstname}{member_firstname}{/if}"/>
                </p>

                <p>
                        <label for="member_lastname">{label:member_lastname}:</label>
                        <input type="text" name="member_lastname" id="member_lastname" value="{if member_lastname}{member_lastname}{/if}"/>
                </p>

                <p>
                        <label for="member_gender">{label:member_gender}</label>
                        {options:member_gender}
                        <input type="radio" id="member_gender" name="member_gender" value="{option_value}" {checked} />{option_value}
                        {/options:member_gender}
                </p>

                <p>
                        <label for="member_address">{label:member_birthday}</label>
                        <input type="text" name="member_birthday" id="member_birthday" value="{member_birthday}" maxlength="23" size="25"/>
                </p>
        </fieldset>
        <br/>
        <fieldset>
                <legend>Native member field</legend>
                <p>Mative member fields like location, url, signature, etc... can be handled by creating a channel field with the same name prefixed with "_member"
                        For example member_signature will sync to the signature field. Custom member fields can be handled in the same way. Just create a channel field prefixed with "member_" and the value
                        will also be saved to the profile.</p>

                <p>
                        <label for="member_signature">Native member signature</label>
                        <input type="text" name="member_signature" id="member_signature" value="{if member_signature}{member_signature}{/if}"/>
                </p>

        </fieldset>

        <fieldset>
                <h4>Login details</h4>

                <p>
                        <label for="username">Email*:</label>
                        <input type="text" name="email" id="email" value="{if email}{email}{/if}"/>
                        <br/>(this will be your login/username if 'use email as username' has been set)
                </p>

                <p>
                        <label for="password">Password*:</label>
                        <input type="password" name="password" id="password" value="{if password}{password}{/if}"/>
                </p>

                <p>
                        <label for="password_confirm">Confirm password*:</label>
                        <input type="password" name="password_confirm" id="password_confirm" value="{if password_confirm}{password_confirm}{/if}"/>
                </p>

                <p>
                        <label for="terms_of_service">Terms of service:</label>
                        <textarea name='terms' rows='4' readonly>All messages posted at this site express the views of the author, and do not necessarily reflect the views of the owners and administrators
                                of this site.By registering at this site you agree not to post any messages that are obscene, vulgar, slanderous, hateful, threatening, or that violate any laws. We will
                                permanently ban all users who do so.We reserve the right to remove, edit, or move any messages for any reason.</textarea>
                </p>

                <p>
                        <label for="accept_terms">Accept terms of service?*</label>
                        <input type='checkbox' name='accept_terms' value='y' {if accept_terms == "y"}checked="checked"{/if} />
                </p>

                {if captcha}
                <p>
                        <label for="captcha">{lang:captcha}*</label>
                        {captcha}<br/>
                        <input type="text" id="captcha" name="captcha" value="" size="20" maxlength="20" style="width:140px;"/>
                </p>
                {/if}
        </fieldset>
        <p>
                <input type="submit" value="Register" class="form-submit"/>
        </p>
        <p>* Required fields</p>

        {/exp:visitor:registration_form}

{/if}

Registration

{exp:visitor:registration_form}

Prerequisites

Before setting up the registration tag:

  1. Update your guest member group settings to make sure "include members in author lists" is set
  2. Update your visitor channel settings, in the "channel forms" area, to make sure the default status is "guests".

Registration tag parameters

return

This parameter allows you to define where the user is returned to when finishing the registration

return="account/registration/success"

error_handling

Default off, set to “inline” to enable inline error handling.

error_delimiters

Error delimiters of errors when selecting inline error_handling. Each error will be wrapped in this piped parameter error_delimiters=’<span class=”error”>|</span>’

id

css id of the form

class

css class of the form

include_jquery

Included by default, set include_jquery =”no” to use your own copy of jQuery

preserve_checkboxes

Included by default

safecracker_head (EE versions prior to 2.7.0)

Included by default. Adds necessary Javascript to your form. If you don’t require Javascript functionality, set to “no”. In versions higher or equal to 2.7.0. use the include_assets paramter instead http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#include-assets

Optional safecracker parameters (EE versions prior to 2.7.0)

The following SafeCracker parameters can be used in the registration form tag:

dynamic_title=”[member_firstname] registration” json=”yes” datepicker=”yes” rules:my_field_name=”required|min_length[5]” secure_action secure_return return_X

See the SafeCracker documentation for more details about these parameters

Channel Form parameters (EE versions >= 2.7.0)

See the channel form documentation for available tags http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_form/#parameters

allowed_groups

When setting the membergroup upon registration, you have to provide the group ids of the allowed member groups as a pipe. allowed_groups=”5|6” Use a field with name “group_id” to select the member group in the registration form. (example provided below)

autologin

When member preferences “Require Member Account Activation?” is set to none, the newly registered member will be logged in automatically. yes/no (default: yes)

Registration tag variables

Error handling variables

The following native member error fields are available when the parameter error_handling="inline" is set:

{if field_errors:count}
    // Display all errors
    {field_errors}
        {error}
    {/field_errors}

    // Display field-specific errors
    {error:username}
    {error:screen_name}
    {error:email}
    {error:current_password}
    {error:password}
    {error:captcha}
    {error:accept_terms}

    // Display custom-field-specific errors
    {error:your_custom_fieldname}
{/if}

Registration tag examples

Basic example

   {exp:visitor:registration_form error_handling="inline" return='account/register/success'}

            {field_errors}{error}{/field_errors}

            Email*: <input id="email" name="email" type="text" value="" />
            {error:email}

            Password*: <input id="password" name="password" type="password" value="" />
            {error:password}

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

            Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
            {error:member_firstname}

            Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
            {error:member_lastname}

            Gender (radiobuttons): {options:member_gender} <input id="member_gender" name="member_gender" type="radio" value="{option_value}" />{option_value} {/options:member_gender}

            Birthday (datepicker): <input id="member_birthday" maxlength="23" name="member_birthday" size="25" type="text" value="" />

            <input class="form-submit" type="submit" value="Register" />

        {/exp:visitor:registration_form}

Choosing membergroup during registration

When allowing to choose the membergroup upon registration, make sure to use the allowed_groups parameter and a field with name “group_id”

    {exp:visitor:registration_form error_handling="inline" return='account/register/success' allowed_groups="5|6"}

            {field_errors}{error}{/field_errors}

            Select member group:
            <select name="group_id">
            <option value="5">Group with id 5</option>
            <option value="6">Group with id 6</option>
            </select>

            Email*: <input id="email" name="email" type="text" value="" />
            {error:email}

            Password*: <input id="password" name="password" type="password" value="" />
            {error:password}

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

            Member firstname: <input id="member_firstname" name="member_firstname" type="text" value="" />
            {error:member_firstname}

            Member lastname: <input id="member_lastname" name="member_lastname" type="text" value="" />
            {error:member_lastname}

            <input class="form-submit" type="submit" value="Register" />

        {/exp:visitor:registration_form}

Working with native member fields

Native custom member fields can be used when integrating with MailChimp/Campaign Monitor subscriptions which are handled by other extensions and depend on native fields.

Native fields like signature, url, locations etc... and custom created member fields can be managed by creating a channel field with the same name prefixed with “member_”. Changes in these channel fields will be reflected in the native fields.

   {exp:visitor:registration_form error_handling="inline" return='account/register/success'}

        {field_errors}{error}{/field_errors}

        Email*: <input id="email" name="email" type="text" value="" />
        {error:email}

        Password*: <input id="password" name="password" type="password" value="" />
        {error:password}

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

        Member signature: <input name="member_signature" type="text" value="" />
        {error:member_signature}

        Member location: <input name="member_location" type="text" value="" />
        {error:member_location}

        <input class="form-submit" type="submit" value="Register" />

    {/exp:visitor:registration_form}

Support

Having problems setting up and/or using Visitor? Support is offered from 10am to 4pm EST weekdays. Send us an email at help@eeharbor.com and we will respond as quickly as we can.