Friends 1.x

Legacy documentation for Friends 1.x.

The Friends:Mutual_Friends function displays friends that the current member profile and the currently logged in member have in common. This is similar to the Facebook feature. Basically, if Moe is friends with Curly and Larry, and Curly and Larry are both friends, when Moe views Curly's profile, he'll see Larry in the Mutual Friends list. Now, hopefully that didn't confuse you!

{exp:friends:mutual_friends} content {/exp:friends:mutual_friends}

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.

friend_id=

friend_id="{segment_3}"

This parameter is the ID of the friend the currently logged in user is comparing friends with. You can hardcode a member ID, pass it through an embed, or grab it from the URI.

friend_username=

friend_username="{segment_3}"

This parameter is the username of the friend the currently logged in user is comparing friends with. You can hardcode a username, pass it through an embed, or grab it from the URI.

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}"

This parameter is usually the ID of the currently logged in member, but is available in the event you want to compare to specific users' friends. You otherwise wouldn't specify this parameter. You can hardcode a member ID, pass it through an embed, or grab it from the URI. Alternatively, you can use the username parameter.

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.

reciprocal=

reciprocal="y"

This parameter allows you to control whether to show reciprocal or "independent" friendship types. A reciprocal friendship is when both members have added each other to their friends lists. An independant friendship is when a friendship is not confirmed by the other user. The default shows both reciprocal and independant friends.

sort=

sort="desc"

You can sort by asc or desc.

username=

username="{segment_3}"

This parameter is usually the ID of the currently logged in member, but is available in the event you want to compare to specific users' friends. You otherwise wouldn't specify this parameter. 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

The variables above are available as conditionals. Additionally these exist as well:

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 mutual friends between a given user and the currently logged in user, assuming the friends member ID is in the 3rd segment of the URI:

<h3>Mutual Friends</h3>

<ul>
{exp:friends:mutual_friends
    friend_id="{segment_3}"
    dynamic="off"
    reciprocal="y"
}
    <li>
        <a href="{path='friends/profile'}/{friends_member_id}/">
            {friends_screen_name}
        </a>
    </li>
    {if friends_no_results}
        <li>You and this user currently have no friends in common.</li>
    {/if}
{/exp:friends:mutual_friends}
</ul>