Last updated June 26, 2010. Created on May 16, 2009.
Edited by IceCreamYou. Log in to edit this page.

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.

If you like this submodule, you may want to try using it with the Facebook-style Statuses Tag Suggestions module, which offers inline tag suggestions as you type.

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_has_tags($sid, $type = NULL)
Determines whether a given status has tags (optionally of a given type). Returns the number of tags of the given type(s) the relevant status has. $sid is the Status ID of the relevant status. $type is the type of tag ("user" or "term") or an array of tag types.
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 or User ID of the tag to check. $type is the type of tag: "user" or "term."
facebook_status_tags_status_has_tag_by_name($sid, $tag, $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 $tag is the name 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 = 5, $time = 'all', $options = array())
Gets #hashtags by popularity and returns an array of taxonomy term objects ordered by popularity (with the most popular term first). See facebook_status_tags_popular() for details.
facebook_status_tags_popular_users($count = 5, $time = 'all', $options = array())
Gets the users that have been @mentioned the most. Returns an array of user account objects ordered by frequency of reference (most popular first). See facebook_status_tags_popular() for details.
facebook_status_tags_popular($type = 'term', $count = 5, $time = 'all', $options = array())
Get tags by reference popularity. Returns an array of user or taxonomy term objects, ordered by popularity (most popular first) and with the property "popularity" added to each object. $type is the type of tag ("user" for @mentions or "term" for #hashtags). $count is the number of tags to return. $time is the time period for which to consider users' popularity. $time can be any of the following:
  • "day," "week," "month," "year," or "all," in which case statuses posted within the past day, week, month, year, or epoch (respectively) will be considered
  • a UNIX timestamp, in which case statuses posted after that date will be considered
  • a negative integer N, in which case statuses posted within the last N seconds will be considered

$options is an associative array. Keys are the options, values are booleans:

  • include self updates: Results should include status updates posted to the relevant user's own profile. Default is TRUE.
  • include messages to others: Results should include status messages from one user to another. Default is TRUE.
  • current user only: Results should only include statuses posted by the current user. Default is FALSE for terms and TRUE for users.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.