Friends 1.x

Legacy documentation for Friends 1.x.

`The Friends:Invites function allows your users to view a list of all ingoing/outgoing friend requests that have not yet been confirmed. It basically allows your users to check on the status of a friend request they sent, or show them friend requests from other users.

{exp:friends:invites} content {/exp:friends:invites}

Parameters

The following parameters are available for use:

dynamic=

dynamic="off"

This parameter is available to stop the loop from looking into the URI for an ID of any type.

invite_type=

invite_type="incoming"

This parameter allows you to filter the list of friends by the friend request type. Options are:

  • incoming (default) - friend requests from other members.
  • outgoing - friend requests sent by the given user.

limit=

limit="10"

This parameter controls how many results will be outputted. The limit will default to 100 members if a value is not specified.

member_id=

member_id="{segment_3}"

By specifying this parameter, you can view invitations for another member. You can hardcode a member ID, pass it through an embed, or grab it from the URI. Alternatively, you can use the username parameter.

member_group_id=

member_group_id="5|6|9"

This parameter allows you to filter the results by one or more member group ID's. Separate multiple groups with the pipe (|) character.

orderby=

orderby="screen_name"

This parameter gives you the ability to control the order in which your results are ordered in the list. You can order by any variable that you can parse on as well as random.

paginate=

paginate="both"

This parameter allows you to control where the pagination will display. Options are top, bottom, or both. Used in conjunction with the friends_paginate variable pair.

search_screen_name=

search_screen_name="ja"

This parameter allows you to filter the member list by those members who share the same first few letters of their screen name. For example, if you specify ja in the parameter, your results may be Jason, Janet, Jared, etc. It's not necessary to specify this parameter though. If you have an additional segment in the URI named screen_name, followed by a value, the search will be performed automatically, as long as the dynamic parameter is NOT set to off.

search_username=

search_username="fur"

This parameter allows you to filter the member list by those members who share the same first few letters of their username. For example, if you specify fur in the parameter, your results may be furly, furby, furnace_eater, etc. It's not necessary to specify this parameter though. If you have an additional segment in the URI named username, followed by a value, the search will be performed automatically, as long as the dynamic parameter is NOT set to off.

show_blocked=

show_blocked="yes"

This parameter allows you to include blocked members in your list of incoming friend requests. To include blocked members, specify yes. The default is no.

sort=

sort="desc"

You can sort by asc or desc.

username=

username="{segment_3}"

By specifying this parameter, you can view invitations for another member. You can hardcode a username, pass it through an embed, or grab it from the URI. Alternatively, you can use the member_id parameter.

Variables

All standard and custom member fields and usual Friends variables are available for use here. Additionally, these exist as well:

friends_count

{friends_count}

This variable outputs the display order number for each result in the list of users.

friends_switch

{friends_switch="one|two"}

This variable allows you to switch a CSS class back and forth for all outputed results.

friends_total_results

{friends_total_results}

This variable outputs the total amount of results outputted in your list.

Variable Pairs

The following variable pairs are available for use:

friends_paginate

{friends_paginate}
    Page {friends_current_page} of {friends_total_pages} pages
    {friends_pagination_links}
{/friends_paginate}

Pagination is available for this tag and works just like regular pagination, but each variable is prepended with friends_. Used in conjunction with the paginate parameter.

Conditionals

You can run conditionals on any of the single variables available above. Additionally, these are available:

if friends_no_results

{if friends_no_results}
    Sorry, no results were found.
{/if}

This conditional displays its contents when there are no results found for this tag.

Examples

The code below will output a simple list of all incoming friend requests (sent from other users) for the currently logged in member:

<h3>The following users would like to be your Friend </h3>

<ul>
{exp:friends:invites
    invite_type="incoming"
    orderby="screen_name"
    sort="asc"
}
    <li>
        {friends_screen_name}
        (added on {friends_entry_date format="%F %j, %Y"})
        <a href="{path='friends/profile'}/{friends_member_id}/">
            View Profile
        </a> | 
        <a href="{path='friends/add'}/{friends_member_id}/">
            Confirm this Friend
        </a>
    </li>
{/exp:friends:invites}
</ul>