Friends 1.x

Legacy documentation for Friends 1.x.

The Friends:Member_Of_Group tag is a simple function that determines whether or not the currently logged in user is a member of a group. It needs to know the group ID or name, so you would typically place this loop inside the Friends:Groups loop, or have it grab the group name or ID from the URI.

{exp:friends:member_of_group} content {/exp:friends:member_of_group}

Parameters

The following parameters are available for use:

friends_group_id=

friends_group_id="{friends_group_id}"

The Friends:Member_Of_Group tag will automatically grab the group ID or name from the URI if you have it prepended by group in the URI, but this parameter is available to use, should you be placing it within the Friends:Group loop.

Conditionals

The following conditionals are available for use:

if member_of_group

{if member_of_group == "y"}
    This user is a confirmed member of this group.
{/if}

This conditional shows its contents if the currently logged in user is a confirmed member of the group. This conditional contains a value of either y (is confirmed member of group), or n (is NOT confirmed member of group).

Examples

The following code shows how this loop might look like in your template:

{exp:friends:groups}

    <h3>Group: {friends_group_title}</h3>
    <p>{friends_group_description}</p>

{!-- Begin Member_Of_Group function --}

    {exp:friends:member_of_group
        friends_group_id="{friends_group_id}"
    }
        {if member_of_group == "y"}
            <p>You are a member of this Group</p>
        {/if}
        {if member_of_group == "n"}
            <p>Would you like to Joing this Group?
                <a href="{path='friends/group_add'}/group/{friends_group_id}/">Click here!</a></p>
        {/if}
    {/exp:friends:member_of_group}

{!-- // End Member_Of_Group function --}

{/exp:friends:groups}