function notifications_content_comment_load in Notifications 6
Same name and namespace in other branches
- 5 notifications_content/notifications_content.module \notifications_content_comment_load()
- 6.4 notifications_content/notifications_content.module \notifications_content_comment_load()
- 6.2 notifications_content/notifications_content.module \notifications_content_comment_load()
- 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_notifications in notifications_content/
notifications_content.module - Implementation of hook_notifications()
File
- notifications_content/
notifications_content.module, line 706 - Subscriptions to content events
Code
function notifications_content_comment_load($cid) {
static $cache;
if (!isset($cache[$cid])) {
$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));
$comment = drupal_unpack($comment);
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$cache[$cid] = $comment;
}
return $cache[$cid];
}