Friends 1.x

Legacy documentation for Friends 1.x.

The Friends:Invite_Form function is a referral system that allows your users to invite other people to the site. All invites are recorded in the database and if the invited person registers on the website, a rereferral credit will be given to the inviter. Consequently, the Friends:Referral_Count tag is available to output referral stats for any given member.

Additionally, a user can also invite the person(s) to one of the groups they own in the same submission. In the event an email address of an already existing site member is invited, the usual friend request proceedure will take place instead of sending an invitation request.

Upon registration from a person with the invited email address, the inviter receives a credit for the successful referral.

{exp:friends:invite_form} content {/exp:friends:invite_form}

Parameters

The following parameters are available for use:

return=

return="template_group/template"

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

notification_invite=

notification_invite="friends_notifications/site_invite"

This parameter controls which EE template to use for your website invite notification template.

notification_request=

notification_request="friends_notifications/friend_request"

This parameter controls which EE template to use for your friend request notification template. Available in the event the invited email address belongs to an already registered site member.

notification_confirm=

notification_confirm="friends_notifications/friend_confirm"

This parameter controls which EE template to use for your friend confirm notification template. Available in the event the invited email address belongs to an already registered site member.

notification_group_invite=

notification_group_invite="friends_notifications/group_invite"

This parameter controls which EE template to use to format a notification to the user who is being invited to join a group. Available in the event the invited email address belongs to an already registered site member.

subject_invite=

subject_invite="{friends_inviter_screen_name} would like you to join the {site_name} site!"

This parameter outputs the subject line for the notification email sent out to recipients of the website invitation.

subject_request=

subject_request="{friends_inviter_screen_name} has added you as a Friend!"

This parameter outputs the subject line for the notification email when a user is initiating a friend request. Available in the event the invited email address belongs to an already registered site member.

subject_confirm=

subject_confirm="{friends_inviter_screen_name} has confirmed you as a Friend!"

This parameter outputs the subject line for the notification email when a user is confirming a friend request. Available in the event the invited email address belongs to an already registered site member.

subject_group_invite=

subject_group_invite="{friends_owner_screen_name} would like you to join the {friends_group_title} group"

This parameter outputs the subject line for the notification email to the user who is being invited to join a group. Available in the event the invited email address belongs to an already registered site member.

Variable Pairs

The following variable pairs are available for use:

groups

{groups} {/groups}

This variable pair allows you to display a list of all groups the currently logged in user owns, convenient for created a select menu for including a group invite along with the site invites. Within it, the following variables are available:

  • {friends_group_description} - displays the description of the group
  • {friends_group_id} - displays the ID of the group.
  • {friends_group_name} - displays the name (AKA short name) of the group.
  • {friends_group_title} - displays the title of the group.

Form Fields

The following form fields are available for use:

friends_emails

<textarea name="friends_emails"></textarea>

This form field is where the user will enter a list of emails they'd like to invite to your site. Multiple values can be separated by commas or line breaks.

friends_group_id

<select name="friends_group_id">
    <option>Select Group</option>
    {groups}
        <option value="{friends_group_id}">{friends_group_title}</option>
    {/groups}
</select>

This form field allows the user to attach a group invite along with the site invitation. Only 1 group invite can be specified, and can only groups the user has created can be sent.

Examples

The following code should be a complete example for using this function regularly:

<h3>Invite your friends to this site!</h3>
<p>Enter the email addresses of your friends in the field below separated by commas or line breaks.</p>

{exp:friends:invite_form
    return="friends/invite/success"
    notification_invite="friends_notifications/site_invite"
    subject_invite="{friends_inviter_screen_name} would like you to join the {site_name} site!"
    notification_request="friends_notifications/friend_request"
    notification_confirm="friends_notifications/friend_confirm"
    subject_request="{friends_inviter_screen_name} has added you as a Friend!"
    subject_confirm="{friends_inviter_screen_name} has confirmed you as a Friend!"
    notification_group_invite="friends_notifications/group_invite"
    subject_group_invite="{friends_owner_screen_name} would like you to join their group!"
}

    <p>
        Emails:
        <textarea name="friends_emails"></textarea>
    </p>
    <p>
        Group:
        <select name="friends_group_id">
            <option>Select Group</option>
            {groups}
                <option value="{friends_group_id}">{friends_group_title}</option>
            {/groups}
        </select>
    </p>
    <p>
        <input type="submit" name="submit" value="Invite Friends!" />
    </p>

{/exp:friends:invite_form}

Notification Templates

For your notification templates, you use regular EE templates, and just add code like this:

Site Invitation Notification ("friends_notifications/site_invite")

Hello,

You have just received an invitation from
{friends_inviter_screen_name} to join the "{site_name}" website.

Click the link below to accept this invitation and create an account:
{path='member/register'}

To view {friends_inviter_screen_name}'s profile, click here:
{path='members/profile'}/{friends_inviter_member_id}/

All Other Notifications

To view examples of all other available notification email templates, see Friends:Add and Friends:Group_Add documentation.