View Feed
Use this tag to display the activity items in a template.
{exp:activity_feed:feed}{/exp:activity_feed:feed}
Table of Contents
Parameters
type
Accepted values:
- members - includes member_joins
- member_joins - when someone joins your site
Weblog Module
- weblogs - includes entries and comments
- weblog_entries - when a blog post goes live
- weblog_comments - when someone posts comment
Discussion Forum Module
- forums - includes topics and posts
- forum_topics - when someone starts a new forum topic
- forum_posts - when someone replies to a forum topic
Photo Gallery Module
- galleries - includes photos and comments
- gallery_photos - when a photo gets uploaded into the photo gallery
- gallery_comments - when someone posts a comment on a photo
Solspace’s Video Module
- videos - includes entries
- video_entries - when a new video is added
d/d User Groups Module
- user_groups - includes joins, topics, and replies
- user_groups_joins - when someone joins a User Group
- user_groups_topics - when a topic is started in a User Group
- user_groups_replies - when someone replies to a topic in a User Group
member_id
weblog
Enter the short name of a weblog, or multiple weblog names separated by a “|”
Example: weblog=“bugs|features”
weblog_id
Enter the ID of a weblog, or multiple weblog IDs separated by a “|”
weblog_status
Enter the status you want to include for weblog_entries and weblog_comments. Separate multiple statuses by a “|”
user_group_id
photo_status
Enter the status you want to include for gallery_photos and gallery_comments. Separate multiple statuses by a “|”
Accepted values: ‘o’, ‘c’
limit
Variables
The following are available in this tag.
actor_member_id
actor_screen_name
actor_photo
actor_avatar
action
item_id
item_title
item_url_title
parent_reference
This is the text that refers to the parent item. For example, if Joe User commented on the blog post ‘Test Post’, the text ‘on the blog post’ would be your parent_reference. These values can be customized for each activity type in the module’s preferences section.
parent_id
parent_title
parent_url_title
grandparent_reference
This is the text that refers to the grandparent item. For example, if Joe User commented on the blog post ‘Test Post’ in the blog ‘Weblog’, the text ‘in the blog’ would be your grandparent_reference. These values can be customized for each activity type in the module’s preferences section.
grandparent_id
grandparent_title
grandparent_url_title
item_date format=”“
Parsed just like standard entry_dates in EE (See the official date docs here).
Note: We recommend NOT using the format=”“, and instead using the Timesince Plugin to display the amount of time that has elapsed since the activity item was done. This is the method we used in the example below.
Download the Timesince Plugin
(from Steve P. Sharpe at Gleam Studios)
Conditionals
if type=”“
Since most of the different feed types require different styling or links within them, we recommend you use this conditional to determine what to display. See the example below for this type of use.
See the type list in the parameter section above for all accepted values. You can use all of them except for the ones in bold.
All variables
Simple Example
actor_screen_name: Joe User
action: commented
parent_reference: on the blog post
parent_title: Blog Post
grandparent_reference: in the blog
grandparent_title: The Weblog
Put it all together:
Joe User commented on the blog post ‘Blog Post’ in the blog ‘The Weblog’ - 27 minutes ago
{exp:activity_feed:feed type="weblog_comments" limit="5"}
{actor_screen_name} {action} {parent_reference} '{parent_title}' {grandparent_reference} '{grandparent_title}' - {exp:timesince}{item_date}{/exp:timesince}
{/exp:activity_feed:feed}
Advanced Example
<ul class="activity-feed">
{exp:activity_feed:feed limit="5"}
<li>
<a href="/members/profile/{actor_member_id}/">
{if actor_photo != ""}
<div class="feed-image">
<img src="/images/member_photos/{actor_photo}" width="30" height="30" />
</div>
{if:else}
<div class="feed-image">
<img src="/images/site_images/default-user.jpg" width="30" height="30" />
</div>
{/if}
</a>
<div class="feed-text">
<a href="/members/profile/{actor_member_id}/">
{actor_screen_name}
</a> {action}
{if type == "member_joins"}
<a href="/">Adoptive Families Circle</a>
{/if}
{if type == "weblog_entries"}
<a href="/blogs/post/{item_url_title}/">
{item_title}
</a> {parent_reference}
<a href="/blogs/blog/{parent_url_title}/">
{parent_title}
</a>
{/if}
{if type == "weblog_comments"}
{parent_reference}
<a href="/blogs/post/{parent_url_title}/#comment-{item_id}">
{parent_title}
</a>
{/if}
{if type == "forum_topics"}
<a href="/forums/viewthread/{item_id}/">
{item_title}
</a> {parent_reference}
<a href="/forums/viewforum/{parent_id}/">
{parent_title}
</a>
{/if}
{if type == "forum_posts"}
{parent_reference}
<a href="/forums/viewreply/{item_id}/">
{parent_title}
</a>
{/if}
{if type == "gallery_photos"}
<a href="/photos/full/{item_id}/">
{item_title}
</a> {parent_reference}
<a href="/photos/album/C{parent_id}/">
{parent_title}
</a>
{/if}
{if type == "gallery_comments"}
{parent_reference}
<a href="/photos/full/{parent_id}/#comment-{item_id}">
{parent_title}
</a>
{/if}
{if type == "video_entries"}
<a href="/videos/watch/{item_id}/">
{item_title}
</a>
{/if}
{if type == "user_groups_joins"}
<a href="/groups/group/{item_url_title}/">
{item_title}
</a>
{/if}
{if type == "user_groups_topics"}
<a href="/groups/topic/{item_id}/">
{item_title}
</a> {parent_reference}
<a href="/groups/group/{parent_url_title}/">
{parent_title}
</a>
{/if}
{if type == "user_groups_replies"}
{parent_reference}
<a href="/groups/topic/{parent_id}/#reply-{item_id}">
{parent_title}
</a> {grandparent_reference}
<a href="/groups/group/{grandparent_id}/">
{grandparent_title}
</a>
{/if}
<br/>
<span class="feed-meta">
{exp:timesince}{item_date}{/exp:timesince}
</span>
</div>
</li>
{/exp:activity_feed:feed}
</ul>
Category:Activity Feed -> Tags