You are here

function notifications_content_comment_load in Notifications 6.4

Same name and namespace in other branches
  1. 5 notifications_content/notifications_content.module \notifications_content_comment_load()
  2. 6 notifications_content/notifications_content.module \notifications_content_comment_load()
  3. 6.2 notifications_content/notifications_content.module \notifications_content_comment_load()
  4. 6.3 notifications_content/notifications_content.module \notifications_content_comment_load()

Load comments with caching @ TODO See if this may be some use, or drop

1 call to notifications_content_comment_load()
notifications_content_comment_cid2title in notifications_content/notifications_content.module
Mapping from comment cid to title
1 string reference to 'notifications_content_comment_load'
notifications_content_notifications in notifications_content/notifications_content.module
Implementation of hook_notifications()

File

notifications_content/notifications_content.module, line 791
Subscriptions to content events

Code

function notifications_content_comment_load($cid) {
  $cache =& messaging_static(__FUNCTION__);
  if (!$cache || !array_key_exists($cid, $cache)) {
    $comment = db_fetch_object(db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d', $cid));
    if ($comment) {
      $comment = drupal_unpack($comment);
      $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
    }
    $cache[$cid] = $comment;
  }
  return $cache[$cid];
}