Friends 1.x

Legacy documentation for Friends 1.x.

Hugs are given to friends/members from users by using the Friends:Hug function. The Friends:Hugs function displays a list of all hugs given to a member. This can either be used to show hugs recieved from other users, or show other users you've hugged.

{exp:friends:hugs} content {/exp:friends:hugs}

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.

friends_only=

friends_only="y"

This parameter show hugs sent to or received from reciprocal friends only.

hug_label=

hug_label="Poked"

This parameter is optional and allows you to filter by the name of the label that was given to the hug. It's an optional feature that allows you to do more than hugging, and lets you do custom actions such as Poked, Tickled, etc. The default value is hug.

limit=

limit="10"

This parameter allows you to set a limit of hugs results you'd like to show for a given member. The default is 10.

member_id=

member_id="{segment_3}"

This parameter allows you to view hugs given/recieved for a specific member by specifying their member ID. You can hardcode a member ID, pass it through an embed, grab it from the URI, or specify CURRENT_USER to display results for the currently logged in user. Alternatively, you can use the username parameter.

orderby=

orderby="date"

This parameter gives you the ability to control the order in which your results are ordered in the list. You can order by most member and friends variables that you can parse.

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.

sort=

sort="desc"

You can sort by asc or desc.

trigger=

trigger="cheese"

If you'd like to have the Hugs loop dynamically recognize a username in the URI, this parameter allows you to specify which trigger you're using in the URI to prepend the username segment. For example, your link might look like this: http://www.yoursite.com/friends/hugs/cheese/pie_man/

type=

type="sender"

This parameter allows you control the output of the Hugs results. Options are recipient - hugs you've recieved from other members, or sender - hugs you've given to other members. The default is recipient.

username=

username="{segment_3}"

This parameter allows you to view hugs given/recieved for a specific member by specifying their username. You can hardcode a username, pass it through an embed, grab it from the URI, or specify CURRENT_USER to display results for the currently logged in user. 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_hug_date

{friends_hug_date format="%F %j, %Y"}

This variable displays the date the hug was given or received.

friends_hug_label

{friends_hug_label}

This variable displays the label that was given to the hug. It's an optional feature that allows you to do more than hugging, and lets you do custom actions such as Poked, Tickled, etc. The default value is hug.

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 following conditionals are available for use:

if friends_no_results

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

Thi conditional evaluates to true and displays it's contents when there are no results found for this tag.

Examples

Displaying Hugs Received From Other Users

The following example will display received hugs for the currently logged in user:

<h3>Hugs You've Received:</h3>
<ul>
{exp:friends:hugs
    member_id="CURRENT_USER"
    limit="15"
}
    <li>{friends_screen_name} hugged you on
        {friends_hug_date format="%F %j, %Y"}</li>
{/exp:friends:hugs}
</ul>

Displaying Hugs Sent To Other Users

The following example will display hugs sent from the currently logged in user:

<h3>Hugs You've Given to Others:</h3>
<ul>
{exp:friends:hugs
    type="sender"
    member_id="CURRENT_USER"
    limit="15"
}
    <li>You hugged {friends_screen_name} on
        {friends_hug_date format="%F %j, %Y"}</li>
{/exp:friends:hugs}
</ul>

Displaying Custom Hugs Recieved From Other Users

The following example will display received hugs for the currently logged in user that use the custom labeling feature available with the Hug feature:

<h3>You've Recently Received:</h3>
<ul>
{exp:friends:hugs
    member_id="CURRENT_USER"
    limit="5"
}
    <li>{friends_screen_name} <b>{friends_hug_label}</b> you on
        {friends_hug_date format="%F %j, %Y"}</li>
{/exp:friends:hugs}
</ul>

The above code could parse as (depending on the values you provided with the Hug function):

<h3>You've Recently Received:</h3>
<ul>
    <li>Jonny <b>poked</b> you on November 9, 2012</li>
    <li>Bob <b>kicked</b> you on November 6, 2012</li>
    <li>Jonny <b>kicked</b> you on November 6, 2012</li>
    <li>Britney <b>tickled</b> you on November 5, 2012</li>
    <li>Sarah <b>hugged</b> you on October 31, 2012</li>
</ul>