Friends 1.x

Legacy documentation for Friends 1.x.

The Friends:Message_Folders function is part of the Private Messaging system and allows you to display a list of all the logged in user's Message folders (Inbox, Sent, etc). These folders would then link to a template with the Friends:Messages loop in it to display a list of messages.

{exp:friends:message_folders} content {/exp:friends:message_folders}

It's available as a variable pair as well, which is great for use when placing it in a template with the Messages loop in it. One thing to know is that this variable pair takes an untraditional approach, and is used OUTSIDE of any EE or Friends module tag. The advantage to using this variable pair is better performance.

{friends_message_folders} content {/friends_message_folders}

Variables

The following variables are available for use:

friends_message_folder

{friends_message_folder}

This variable outputs the name of the message folder (Inbox, Sent, etc).

friends_message_folder_id

{friends_message_folder_id}

This variable outputs the ID of the message folder.

friends_message_folder_read_count

{friends_message_folder_read_count}

This variable outputs the total amount of read messages for each message folder.

friends_message_folder_selected

{friends_message_folder_selected}

This variable parses as selected="selected" for the folder that's being currently viewed and is ONLY available in the variable pair version of this function ({friends_message_folders}{/friends_message_folders}). You'll typically be using this in a form pulldown list in your Messages template. When you have /folder/FOLDER_ID/ in the URI, the variable pair will detect that automatically (see example).

friends_message_folder_total

{friends_message_folder_total}

This variable outputs the total amount of messages for each message folder.

friends_message_folder_unread_count

{friends_message_folder_unread_count}

This variable outputs the total amount of unread messages for each message folder.

Examples

The example code below will output a list of all message folders available to the user:

<ul>
{exp:friends:message_folders}
    <li>
        <a href="{path='friends/messages'}/folder/{friends_message_folder_id}/">
            {friends_message_folder}
            ({friends_message_folder_total})
        </a>
         - ({friends_message_folder_unread_count} Unread)
    </li>
{/exp:friends:message_folders}
</ul>

When you’re linking the folders to a template with the Friends:Messages loop, you’ll typically build the links in this manner: http://www.yoursite.com/friends/messages/folder/FOLDER_ID/

Below is an example of how use of the variable pair version might look when using in your Messages template:

<p>
    Move Selected Messages to
    <select name="friends_message_folder_id">
    {friends_message_folders}
        <option value="{friends_message_folder_id}" {friends_message_folder_selected}>
            {friends_message_folder}
        </option>
    {/friends_message_folders}
    </select>
    <input type="submit" name="submit" value="Move" />
</p>