User:Key Invite
- Home
- Documentation
- Modules
- User
- Tags
- Key Invite
The User:Key function 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.
{exp:user:key} content {/exp:user:key}
Parameters
The following parameters are available for use:
error_page=
error_page="user/error_template"
The 'error_page' 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"
The 'form:attribute' 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"
The 'html' parameter allows you to specify whether the invitation email should use HTML or plain text formatting. Indicate 'yes' for HTML and 'no' for plain text. Default is 'no'
onsubmit=
onsubmit="some_javascript()"
The 'onsubmit' parameter allows you to execute Javascript functions at form submission.
parse=
parse="xhtml"
The 'parse' parameter controls the parsing method used on your invitation template. 'xhtml', 'br' and 'none' and valid parsing methods. Default is 'none'.
return=
return="template_group/template"
The 'return' parameter allows you to return the user to a specified template upon submittal of 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.
template=
template="template_group/template"
The 'template' 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"
The 'word_wrap' 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 seperate EE template that contains most of the variables below, and is specified by the 'template' parameter.
from_email
{from_email}
The 'from_email' variable is available to display the email address specified in the 'from' field.
from_name
{from_name}
The 'from_name' variable is available to display the "from name" specified in the 'name' field.
key
{key}
The 'key' variable is available to display the unique invitiation Key generated by User:Key function.
selected_group_id
{selected_group_id}
The 'selected_group_id' variable is available to display the member group ID specified in the 'member_group' field.
subject
{subject}
The 'subject' variable is available to display the subject specified in the 'subject' field.
to_email
{to_email}
The 'to_email' 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
{member_groups}{/member_groups}
The 'member_groups' 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" value="" />
The 'group_id' 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>
The 'message' 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="" />
The 'subject' 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="template_group/template" html="no" parse="none" word_wrap="no"}
<p>Recipient Email: <input name="recipient_email" /></p>
<p>Member Group
<select name="group_id">
{member_groups}
<option value="{group_id}">{group_title}</option>
{/member_groups}
</select></p>
<p>From Name: <input name="sender_name" value="{site_name}" /></p>
<p>From Email: <input name="sender_email" value="{webmaster_email}" /></p>
<p>Subject: <input name="subject" value="Invitation to join {site_name}!" /></p>
<p>Message: <textarea name="message"></textarea></p>
<p><input type="submit" name="submit" value="Send Invite" /></p>
{/exp:user:key}
The below example is what your notification template might look like:
Hello,
You've recieved a special invitation to register to Example Site!
Your invitation code is: {key}
Please follow this link to complete your registration:
http://www.yoursite.com/user/key_register_template/key/{key}
Thank you,
Example Site
The below example is what your Registration form would look like to accept Invite Key registrations (See User Register Documentation for more information on parameters and variables):
{exp:user:register form:name="some_name" return="template_group/template" require_key="yes" key_email_match="yes"}
<p>Username: <input type="text" name="username" class="input" size="25" /></p>
<p>Screen Name: <input type="text" name="screen_name" class="input" size="25" /></p>
<p>Email Address: <input type="text" name="email" class="input" size="40" /></p>
<p>Password: <input type="password" name="password" class="input" size="25" /></p>
<p>Confirm Password: <input type="password" name="password_confirm" class="input" size="25" /></p>
<input type="hidden" name="key" value="{key}" />
<p>Accept Terms?: <input type="checkbox" name="accept_terms" value="y" /> Accept Terms?</p>
<p><input type="submit" value="submit" class="submit" /></p>
{/exp:user:register}


