You are here

function get_latest_shout in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 modules/shouts/shouts.module \get_latest_shout()

Get the latest shout of a user.

Parameters

$uid user_id of shout to load:

1 call to get_latest_shout()
shouts_user in modules/shouts/shouts.module
Implementation of hook_user().

File

modules/shouts/shouts.module, line 337
Gives the possibility to the user to shout a message.

Code

function get_latest_shout($uid) {
  static $uids = array();
  if (!isset($uids[$uid])) {
    $shout = db_fetch_object(db_query_range('SELECT message, cleared, time FROM {shouts} WHERE uid = %d ORDER BY time DESC', $uid, 0, 1));
    if (isset($shout->message)) {
      $shout->message = filter_xss($shout->message);
      $uids[$uid] = $shout;
    }
    else {
      $uids[$uid] = '';
    }
  }
  return $uids[$uid];
}