Friends 1.x

Legacy documentation for Friends 1.x.

The Friends:Group_Comment_Delete function allows the author of the comment, the owner of the group, or any Super Admin to permanently delete any of the applicable wall comments. Simply link with the comment ID in the URI to the template with the Friends:Group_Comment_Delete function code in it, or submit a POST form.

{exp:friends:group_comment_delete} content {/exp:friends:group_comment_delete}

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 a comment ID.

comment_id=

comment_id="{segment_3}"

The Friends:Group_Comment_Delete loop automatically grabs the comment ID from the URI, but this parameter is available to use, should you be doing something crazy.

Variables

The following variables are available for use:

friends_message

{friends_message}

This variable will output the success message or any errors upon loading the Friends:Group_Comment_Delete template.

Conditionals

The following conditionals are available for use:

failure

{if failure}Error!{/if}

This conditional shows its contents if the request action DOES NOT execute successfully.

success

{if success}Successful!{/if}

This conditional shows its contents if the request action executes successfully.

Examples

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

{exp:friends:group_comment_delete
    comment_id="{segment_3}"
}

    {if success}
        <h3>Successful!</h3>
    {/if}
    {if failure}
        <h3>Error!</h3>
    {/if}

    <p>{friends_message}</p>

{/exp:friends:group_comment_delete}

Setup

To implement this feature into a template, your code would look something like this:

<h3>Group Wall Comments</h3>
<ul>
{exp:friends:group_wall
    friends_group_id="{segment_3}"
    limit="25"
}
    <li class="wall">
        {if logged_in_group_id == "1"}
            <small style="float:right;">
                <a href="{path='friends/delete_group_comment'}/{friends_comment_id}/">(delete)</a>
            </small>
        {/if}
        {friends_comment}<br/>
        By:
        {if logged_in_member_id == friends_member_id}
            <b>You</b>
        {if:else}
            <a href="{path='friends/profile'}/{friends_member_id}/">
                {friends_screen_name}
            </a>
        {/if}
        on {friends_entry_date format="%F %j, %Y at %h:%i %a"}
    </li>
    {if friends_no_results}
        <li>There are currently no comments for this group.</li>
    {/if}
{/exp:friends:group_wall}
</ul>

For something a little more powerful (allowing more conditionals on checking current user to see which deletion permissions they have):

Main Template:

<h3>Group Wall Comments</h3>

{exp:friends:groups
    type="all_groups"
    friends_group_id="{segment_3}"
    limit="1"
    dynamic="off"
}

    {exp:friends:member_of_group
        friends_group_id="{friends_group_id}"
    }

        <h5>Wall Comments For This Group</h5>
        {embed="friends/group_wall"
            friends_group_id="{friends_group_id}"
            {if friends_group_owner_id == logged_in_member_id}
                group_owner="yes"
            {/if}
        }

    {/exp:friends:member_of_group}

{/exp:friends:groups}

Embedded Template:

<ul>
{exp:friends:group_wall
    friends_group_id="{embed:friends_group_id}"
    limit="25"
}
    <li class="wall">
        {if embed:group_owner == "yes" OR
            logged_in_member_id == friends_member_id OR
            logged_in_group_id == "1"
        }
            <small style="float:right;">
                <a href="{path='friends/delete_group_comment'}/{friends_comment_id}/">(delete)</a>
            </small>
        {/if}
        {friends_comment}<br/>
        By:
        {if logged_in_member_id == friends_member_id}
            <b>You</b>
        {if:else}
            <a href="{path='friends/profile'}/{friends_member_id}/">
                {friends_screen_name}
            </a>
        {/if}
        on {friends_entry_date format="%F %j, %Y at %h:%i %a"}
    </li>
    {if friends_no_results}
        <li>There are currently no comments for this group.</li>
    {/if}
{/exp:friends:group_wall}
</ul>