Facebook-style Statuses Tags

Last modified: October 27, 2009 - 02:54

Facebook-style Statuses Tags (FBSST, or facebook_status_tags) is a submodule of Facebook-style Statuses which parses statuses for usernames marked with an "at" sign (@) or taxonomy terms marked with a "hash" sign (#) and themes them appropriately. For example, if "@Dries" was in a status, it may be themed to link to Dries' account on that site. If "#Drupal" was in a status, it would be themed as a link to the page listing statuses that also had the "Drupal" tag. If the module finds a #hashtag in a status that has not yet been added to the vocabulary, it automatically adds the term to the vocabulary.

Taxonomy is not a dependency; if Taxonomy is not enabled, only the username-theming part of the description above will work.

Details

Tags can be written in standard format (i.e. #hashtag or @username) or surrounded by square brackets ([#hello world] or [@Clark Kent]). Surround a tag with square brackets if the tag has word-break characters in it like spaces or periods (full stops). The square brackets will not appear in the text of the status that other users see.

Taxonomy terms and user references marked with a hashmark (#) or "at" sign (@) respectively are always linkified when viewing statuses. However, for the purposes of categorical listings, FBSST is only aware of references in statuses submitted while FBSST was enabled.

Views integration is provided, including two default Views that list statuses containing certain tags or referencing certain users.

Settings

Facebook-style Statuses Tags adds two settings to the Facebook-style Statuses Advanced Settings page at http://example.com/admin/settings/facebook_status/advanced if Taxonomy is enabled. One allows choosing the path that taxonomy terms in statuses will link to; paths can contain the tokens [term-id] or [term-name]. The other allows choosing the vocabulary into which new tags will be added. The Taxonomy part of this module will not work until a vocabulary is set.

Blocks

A "Facebook-style Statuses Popular Tags" block is provided to list the most popular tags. The block's settings allow you to specify how many tags to display, and how long ago statuses could have been posted that will be included in the search for popular tags.

If you want finer control over the block (for example, if you wanted a table instead of a list) you could override the theme function (see below).

Theming

theme_facebook_status_popular_tags($count = NULL, $time = NULL)
Outputs an HTML representation of a list of popular tags. $count is the number of tags to show and $time is how long ago statuses could have been posted that will be included in the search for popular tags (one of "day," "week," "month," "year," "all").

API

facebook_status_tags_get_statuses($tag, $type = 'term', $count = 1, $uid = 0, $pid = 0)
Retrieves an array of status objects that contain the relevant tag. $tag can be the name of a taxonomy term, a username, a taxonomy term ID, or a user ID. $type can be "term" or "user." $count limits the number of statuses to return. If $uid is zero, it has no effect. It can also be a user ID or an array of user IDs, in which case the returned statuses will be limited to statuses posted on the relevant users' profiles. $pid works like $uid except it restricts statuses to those posted by the relevant user(s) (if given).
facebook_status_tags_status_has_tag($sid, $rid, $type = 'term')
Determines whether a given status has a given tag. Returns 1 if the status has the tag or 0 if it does not. $sid is the Status ID of the status to check and $rid is the Term ID of the tag to check. $type is the type of tag: "user" or "term."
facebook_status_tags_get_status_tags($sid, $type = 'term')
Gets the tags that a given status has. Returns an array of taxonomy term objects. $sid is the Status ID of the status for which to retrieve tags. $type is the type of tag: "user" or "term."
facebook_status_tags_popular_terms($count = 1, $time = 'all', $own = FALSE)
Gets tags by popularity and returns an array of taxonomy term objects ordered by popularity (with the most popular term first). $count is the number of terms to return and $time is the time period for which to consider terms' popularity. $time can be "day," "week," "month," "year," or "all." If $own is TRUE, only statuses posted on users' own profiles are counted. Otherwise, all statuses are counted.
 
 

Drupal is a registered trademark of Dries Buytaert.