User Documentation

User:Key template tag

The User:Key tag allows you to send invitations/keys to an email address (or multiple email addresses) through an email notification. These "Key" Invitations have their own unique Key for the member(s) to register to your website. You can specify a custom message to each recipient, as well as pre-package their Key to be assigned to a specific member group upon completion of registration. You can further specify in your User:Register template if a Key is required and/or if the Key and email address they're registering with match the email address packaged with the Key.

NOTE: Only logged in Super Admin's can use the Key Invite feature.

{exp:user:key} content {/exp:user:key}

Parameters

The following parameters are available for use:

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.

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.

html=

html="yes"

This parameter allows you to specify whether the invitation email should use HTML or plain text formatting. Indicate yes for HTML and no (default) for plain text.

parse=

parse="xhtml"

This parameter controls the parsing method used on your invitation template. Valid parsing methods are: xhtml, br and none (default).

onsubmit=

onsubmit="some_javascript()"

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

return=

return="user/success"

This parameter allows you specify a return URL you'd like the user to be returned to after submitting the form. If you would like to show this key on the landing page you designate, use this code: return="template_group/template/%%key%%". The key created will take the place of the %%key%% construct and you can call it into your template as a segment variable.

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.

template=

template="user_inc/key_notification"

This parameter allows you to specify a notification template for use with invitation key notifications. Only when you provide this template will invitation emails be sent. You can use any of your site templates. The template will be used to format the email invitation that will be sent to your new potential members. See example below.

word_wrap=

word_wrap="yes"

This parameter allows you to specify whether the invitation email should have word wrap turned on or off. Indicate yes to leave word wrapping on and no to turn it off.

Variables

The following variables are available for use in your Notification template:

Note: The notification template needs to be a separate EE template that contains most of the variables below, and is specified by the template parameter.

from_email

{from_email}

This variable is available to display the email address specified in the From field.

from_name

{from_name}

This variable is available to display the "from name" specified in the Name field.

key

{key}

This variable is available to display the unique invitation Key generated by User:Key function.

selected_group_id

{selected_group_id}

This variable is available to display the member group ID specified in the group_id field.

subject

{subject}

This variable is available to display the subject specified in the subject field.

to_email

{to_email}

This variable is available to display the "to email" specified in the to field.

Variable Pairs

The following variable pairs are available for use:

member_groups

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

This variable pair allows you to create a list of member groups in a select list or series of radio buttons to pre-assign a user to.

Form Fields

The following form fields are available for use:

group_id

<input name="group_id" />

This is an optional field. If provided, invited members will be assigned to this group ID. Otherwise, your default registration settings will be used. If self activation is in place in a site, the user will be set to Pending until they activate their account through the email link they receive. Once they activate, they are bumped to the member group indicated in the form submission that created their invitation key.

message

<textarea name="message"></textarea>

This field is available for inserting a custom message in your invitation email.

recipient_email

<input name="recipient_email" />

This field is used to enter email address(es) to which the Key invitation email(s) will be sent to. An invitation key will be mailed to all email addresses provided. Separate multiple addresses with commas.

sender_email

<input name="sender_email" value="{webmaster_email}" />

This field is used to provide the email address from which the invitation email is to appear to be sent from.

sender_name

<input name="sender_name" value="{site_name}" />

This field is available to provide a name from which the invitation email is to appear to be sent from.

subject

<input name="subject" value="Invitation to join {site_name}!" />

This field allows you to provide the subject of the invitation email.

Examples

The below example is how your Invitation Key template might look like:

{exp:user:key
    template="user/success"
    html="no"
    parse="none"
    word_wrap="no"
}
    <p>
        <label for="recipient_email">Recipient Email</label>
        <input name="recipient_email" id="recipient_email" />
    </p>
    <p>
        <label for="group_id">Member Group</label>
        <select name="group_id" id="group_id">
        {member_groups}
            <option value="{group_id}">{group_title}</option>
        {/member_groups}
        </select>
    </p>
    <p>
        <label for="sender_name">From Name</label>
        <input name="sender_name" id="sender_name" value="{site_name}" />
    </p>
    <p>
        <label for="sender_email">From Email</label>
        <input name="sender_email" id="sender_email" value="{webmaster_email}" />
    </p>
    <p>
        <label for="subject">Subject</label>
        <input name="subject" id="subject" value="Invitation to join {site_name}!" />
    </p>
    <p>
        <label for="message">Message</label>
        <textarea name="message" id="message"></textarea>
    </p>
    <p>
        <button type="submit">Send Invite</button>
    </p>
{/exp:user:key}

The below example is what your notification template might look like:

Hello,

You've received a special invitation to register to Example Site!
Your invitation code is: {key}

Please follow this link to complete your registration:
http://yoursite.com/user/register/key/{key}

Thank you,

Example Site

The below example is what your Registration form would look like to accept Invite Key registrations:

{exp:user:register
    return="user/registered"
    require_key="yes"
    key_email_match="yes"
}
    <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="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>
    <p>
        <label for="key">Invitation Key</label>
        <input name="key" id="key" value="{key}" />
    </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.