Facebook-style Statuses: Views
The Facebook-style Statuses module provides Views integration to allow you to easily build lists of status updates in whatever format you want. Views integration also means that statuses can be integrated with other modules that use Views, like User Relationships, FriendList, and Flag Friend.
Note: do not build Views with AJAX enabled that also have flags on them which require confirmation. If you do, confirming the flag will redirect to the wrong place, due to an unavoidable bug in the Flag module.
Fields, Sorts, Filters, Arguments
A large number of sorts, arguments, and especially fields and filters are available to allow you to customize your listings as much as possible. Some of these facilitate mimicking features on other sites, such as the Retweet functionality on Twitter or the Conversation links on Facebook.
View Types and Relationships
You can use Statuses as the View Type to start with, or you can start with a User View. Either way you can add a Relationship to the User or Facebook-style Statuses types, respectively, to gain access to the fields that are associated with those types. This is not strictly necessary in many cases--for example, you can use the standard Facebook-style Statuses fields in a User View without a relationship, and you can use fields related to the User table in the Facebook-style Statuses View--but it is necessary if you want to use fields another logical step away. This means that if you had a Facebook-style Statuses View and you wanted to use FriendList data in it, you would need to create a Relationship to the Users table to use FriendList data in your View.
If you want to add flags to your View, you need to create a relationship to the relevant Flag type to expose Flag's options to your View.
Default Views
Percent signs (%) are used in place of arguments in URLs given below.
- facebook_status user/%/status - Provides a list of a user's own status updates as well as messages posted on that user's profile by other users.
- facebook_status_cross_post statuses/conversation/%,% - Like Facebook's "wall-to-wall" feature, shows a listing of statuses between two users on each others' profiles.
- facebook_status_mentions statuses/mentions/%,% - Shows statuses which reference a given user by @userreference. If two users are given in the URL, shows the exchange of user references between them.
- facebook_status_recent statuses/recent - Lists all recent statuses, including those posted on other users' profiles.
- facebook_status_tags statuses/term/% - Lists statuses with the given taxonomy term (terms are assigned with #hashtags, but don't include the hash mark [#] in the URL). Only available if the Facebook-style Statuses Tags submodule is enabled.
Suggested Views
- Statuses of followed users (with the flag module [FBSS provides a default "Follow" flag, but not the Views for it])
- Friends' Statuses (example for User Relationships; example for Flag Friend)
- Users' Last Statuses (filter to Last Status per User)
- Administrative Updates (use like site announcements, filter by role)
- "Most liked statuses" list (ordered by the number of times the default "Like" flag has been used on each status)
- Any other user list; see an example here
Moderating statuses
FBSS is not really designed to have moderated content on the expectation that status updates could be so prolific and from so many users that moderation would be impractical. However, if this is something you need, you should install the Flag module and add an "approved" flag to statuses, then modify the views you're using so they only show statuses flagged as "approved." This would typically involve adding a relationship to the relevant flag type with the "include only flagged content" checkbox enabled.
Note that FBSS does come with Edit and Delete links as Views fields, and that these fields are enabled by default on some default views, and that these fields will only appear if users have permission to see them. Views Bulk Operations can be combined with Rule Sets to do bulk deletion if necessary.
JavaScript View Updates
FBSS includes a feature that allows a View to be rendered as part of the status update form, thus allowing it to automatically update via JavaScript (technically AHAH) whenever the status update form is submitted (assuming, of course, that JavaScript is enabled in the user's browser). This feature is already implemented on default profiles (check the settings to enable it) and a CTools content type is provided for easy integration with Panels.
To take advantage of this feature elsewhere or in custom code, place the PHP snippet given below in the location you would like the status-update-form/view combination to appear (for example, you could put it in a block, a panel pane, a node, etc.) and change it to suit your needs per the instructions in the code comments.
<?php
//Assumes that this display only appears on user profiles.
//You could also get the user account object some other way on other pages if necessary.
$account = user_load(array('uid' => arg(1)));
//Determines the horizontal size of the status update form.
$size = variable_get('facebook_status_size_long', 40);
//The relevant view should take one argument: the User ID of the user on whose profile this display will be shown.
//The facebook_status view is recommended if you don't know which one to use.
//You MUST change this for this code to work.
$view = 'machine_name_of_the_view_to_display';
//Renders the display.
echo theme('facebook_status_form_display', $account, $size, $view);
?>If you have trouble getting this feature to work, make sure the "Use AJAX" option is turned off in the View you chose. Also note that the module will call the "Default" display of the view.
Note
Some people recommend against putting PHP code directly into your site like this, because incorrect PHP can cause your site to malfunction, and when this happens it is often difficult to fix. Also, putting PHP code directly into your site can cause difficulties during upgrades.
Alternatives
If the code above doesn't work for you and you insist on AJAX-updated views on status submission, or if you don't want your view to be part of the form, there is still hope: check out the AJAX Views Refresh module (which requires the AJAX module). This combination claims to allow AJAX-refreshing any view when any form is submitted. FBSS provides integration with the AJAX module, but at the time of writing, the AJAX Views Refresh module is not working.
If this doesn't work for you either, you can force FBSS to do full page refreshes by disabling the Use AHAH to refresh the status update form without refreshing the page setting on the Advanced settings page.
