User Documentation

User:Register template tag

The User:Register tag allows you to create a front-end registration form for your users. The form can also work with the User:Key tag to require an invitation key before registration and assign a member to a specific member group specified with the invitation key.

NOTE: You must be LOGGED OUT to view the contents of your Register form. To make the form visible to Super Admins, you can specify the admin_register parameter. Additionally, an alternate message can be shown by using the if user_no_results conditional.

{exp:user:register} content {/exp:user:register}

Parameters

The following parameters are available for use:

admin_register=

admin_register="yes"

This parameter allows users of member groups that are allowed to administrate members to view the Register form, and submit new user registrations on behalf of others. Using this parameter will prevent the auto-login feature after registration from working (so the admin doesn't become logged in as the member they just created).

allowed_groups=

allowed_groups="5|8"

This parameter gives you flexibility and security against which member groups a user can assign themselves to, should you give them that option. Super Admin member group is not allowed. Works in conjunction with select_member_groups variable pair.

assign_roles=

assign_roles="role_name_1|role_name_2"

If using the User Roles feature, you can assign users to roles through registration. Use the short name of the role(s) you wish for the user to be assigned to upon registration. Use either this feature or the User Assigned Roles feature (where users can assign themselves to roles).

error_page=

error_page="user/error_template"

This parameter allows you to bypass the EE message template for displaying errors, and instead show your own regular template with the error messages. Error template must follow guidelines of User Error Page.

exclude_username=

exclude_username="member|pants"

This parameter allows you to prevent some words from being used as usernames.

form:attribute=

form:class="your_class"

This parameter allows you to control any form attribute for the form in your template. Simply replace attribute with an attribute name such as id, name, class, etc, and specify a value for that attribute. You can specify this parameter multiple times to control as many attributes as necessary. This would normally be done to control your form with Javascript or style it with CSS.

group_id=

group_id="8"

This parameter allows you to force new registrations into a specified member group. This enables you to create multiple Registration forms and use different member groups with each. This parameter respects native EE account activation settings.

key_email_match=

key_email_match="yes"

If using the Invite Key feature, this parameter allows you to require an invitation key to match the email address to which it was paired at the time the key was created using the User:Key function.

onsubmit=

onsubmit="some_javascript()"

This parameter allows you to execute Javascript functions at form submission.

override_return=

override_return="template_group/template"

This parameter allows you to bypass the default EE message template page and brings the user directly to the template URI specified.

require_key=

require_key="yes"

If using the Invite Key feature, this parameter allows to you make sure an invitation key has been submitted.

required=

required="MEMBER_FIELD_NAME|ANOTHER_MEMBER_FIELD_NAME"

This parameter allows you to force your users to enter a value for the specified fields.

return=

return="template_group/template"

This parameter allows you to return the user to a specified template upon successful submittal of form.

secure_action=

secure_action="yes"

This parameter allows you to set the action on the form to have https://. Use for processing forms with SSL.

secure_return=

secure_return="yes"

This parameter allows you to set the return on the form to have https://. Use for processing forms with SSL.

user_assigned_roles=

user_assigned_roles="yes"

If using the User Roles feature, you can set up your User:Register form to allow your users to assign roles to themselves. To allow this feature, specify a value of yes for this parameter, and be sure to specify which roles users are allowed to assign themselves to with the user_assigned_roles_allowed parameter. Used in conjunction with the roles form field.

user_assigned_roles_allowed=

user_assigned_roles_allowed="monkeys|pants_wearers|honey_dippers"

If using the User Roles feature, you can set up your User:Register form to allow your users to assign roles to themselves. To allow this feature, specify a value of yes for the user_assigned_roles parameter, and specify which roles users are allowed to assign themselves to in this parameter. Used in conjunction with the roles form field.

Variables

The following variables are available for use:

captcha

{captcha}

This variable will display a CAPTCHA image if your website requires captcha to register.

key

{key}

If using the Invite Key feature, this variable will output the invitation Key if present in the URL (prepended by a /key/ segment in the URL).

Variable Pairs

The following variable pairs are available for use:

languages

<select name="language">
{languages}
    <option value="{language_name}">{language_label}</option>
{/languages}
</select>

This variable pair helps you build a pulldown menu or set of radio buttons to allow users to set their language. Make sure that the field has a name of language. Use the language_name variable to pass the name of the time zone to the database.

select_member_groups

<select name="group_id">
{select_member_groups}
    <option value="{group_id}">{group_title}</option>
{/select_member_groups}
</select>

This variable pair enables you to provide an option for your users to select a member group to assign themselves to. This has added security measures, and only gives users the options provided in the allowed_groups parameter.

select_MEMBER_FIELD

<select name="MEMBER_FIELD">
{select_MEMBER_FIELD}
    <option value="{value}">{value}</option>
{/select_MEMBER_FIELD}
</select>

This variable pair is a flexible method for creating pull-down menus, radio buttons, etc. In the variable pair, you precede the short_name of the member field with select_. Providing your member field is a Select field with multiple values, it will automatically generate those values for you. Within this variable pair, the following variables become available:

  • value - the values stored as options for the member field.
  • option_index - behaves like a count variable and displays the display order of each value.

Conditionals

In addition to most of the variables above being available for use as conditionals, the following conditional is available for use:

user_no_results

{if user_no_results}
    Sorry, you are currently logged in and cannot view the registration form.
{/if}

This conditional is available for use when a logged in member views a Register form (and/or when the form is not set up for Admin Registration). Instead of displaying the overriding EE error message, using this conditional will display an inline error message instead.

Form Fields

All member fields are available for use as form fields. Just specify the short_name of the field as the field name. Additionally, the following are also available:

accept_terms

<label>
    <input type="checkbox" name="accept_terms" value="y" />
    Accept Terms?
</label>

This field needs to be specified if you require your new registrants to accept your terms of service.

captcha

<input type="text" name="captcha" />

If CAPTCHA is enabled for registrations, this field is required. Used in conjunction with the captcha variable.

email

<input type="text" name="email" />

This field is a required field for registration unless using the Email as Username feature.

key

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

If using the Invite Key feature, this field is where the User:Register form validates the invite Key. The {key} variable will populate from the URL as long as it's preceded by a /key/ segment.

language

<select name="language">
{languages}
    <option value="{language_name}">{language_label}</option>
{/languages}
</select>

This field is available for your users to set their language preference. To help with this, use the languages variable pair to build a pulldown menu or set of radio buttons to allow users to set their language.

password

<input type="password" name="password" />

This field is a required field for registration.

password_confirm

<input type="password" name="password_confirm" />

This field is a required field for registration.

roles

<label>
    <input type="checkbox" name="roles[]" value="monkeys" />
    Monkeys
</label>
<label>
    <input type="checkbox" name="roles[]" value="pants_wearers" />
    Pants Wearers
</label>
<label>
    <input type="checkbox" name="roles[]" value="honey_dippers" />
    Honey Dippers
</label>

If using the User Roles feature, use this field to generate a select menu, radios, checkboxes, etc to allow your users to assign themselves to roles. Specify the role short name or unique ID. Used in conjunction with the user_assigned_roles and user_assigned_roles_allowed parameters.

screen_name

<input type="text" name="screen_name" />

If no screen name is provided, the username will be used in its place.

username

<input type="text" name="username" />

This field is a required field for registration. If using the Email as Username feature, then specify the username field and label it as an Email field. Leave out the email field.

Examples

The below example replicates the native EE Registration form:

{exp:user:register
    return="user/registered"
}
    <p>
        <label for="username">Username</label>
        <input name="username" id="username" />
    </p>
    <p>
        <label for="screen_name">Screen Name</label>
        <input name="screen_name" id="screen_name" />
    </p>
    <p>
        <label for="email">Email</label>
        <input name="email" id="email" />
    </p>
    <p>
        <label for="YOUR_MEMBER_FIELD">YOUR MEMBER FIELD</label>
        <input name="YOUR_MEMBER_FIELD" id="YOUR_MEMBER_FIELD" />
    </p>
    <p>
        <label for="password">Password</label>
        <input type="password" name="password" id="password" />
    </p>
    <p>
        <label for="password_confirm">Confirm Password</label>
        <input type="password" name="password_confirm" id="password_confirm" />
    </p>
{if captcha}
    <p>
        <label for="captcha">Please enter in the word you see:</label>
        {captcha}
        <input type="text" name="captcha" id="captcha" />
    </p>
{/if}
    <p>
        <label>
            <input type="checkbox" name="accept_terms" value="y" />
            Accept Terms?
        </label>
    </p>
    <p>
        <button type="submit">Register</button>
    </p>
{if no_results}
    <p>
        You're currently logged in, and must be logged out to view this form.
    </p>
{/if}
{/exp:user:register}

The below example uses the Email as Username setting, which must be configured correctly to work (via User Preferences control panel). Notice that the Email field is no longer used, and the Username field becomes the Email field, but is still named username:

{exp:user:register
    return="user/registered"
}
    <p>
        <label for="screen_name">Screen Name</label>
        <input name="screen_name" id="screen_name" />
    </p>
    <p>
        <label for="email">Email</label>
        <input name="username" id="email" />
    </p>
    <p>
        <label for="password">Password</label>
        <input type="password" name="password" id="password" />
    </p>
    <p>
        <label for="password_confirm">Confirm Password</label>
        <input type="password" name="password_confirm" id="password_confirm" />
    </p>
{if captcha}
    <p>
        <label for="captcha">Please enter in the word you see:</label>
        {captcha}
        <input type="text" name="captcha" id="captcha" />
    </p>
{/if}
    <p>
        <label>
            <input type="checkbox" name="accept_terms" value="y" />
            Accept Terms?
        </label>
    </p>
    <p>
        <button type="submit">Register</button>
    </p>
{if no_results}
    <p>
        You're currently logged in, and must be logged out to view this form.
    </p>
{/if}
{/exp:user:register}

Support

Having problems setting up and/or using User? 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.