function notifications_forum_link in Forum notifications 6
Implements hook_link().
File
- ./
notifications_forum.module, line 17
Code
function notifications_forum_link($type, $node = NULL, $teaser = FALSE) {
global $user;
$links = array();
// TODO: we should probably do the notifications per-content to remove the $node->type == 'forum' check
if ($type == 'node' && !$teaser && $node->type == 'forum' && notifications_access_subscribe($user)) {
notifications_include('object.inc');
if ($subscriptions = notifications_object_user_subscriptions($type, $node, $user)) {
foreach ($subscriptions as $index => $subscription) {
if ($node->type == 'forum') {
if ($subscription->type == 'thread') {
// rename 'This post' to 'This thread'
$subscription->name = t('This thread');
}
elseif ($subscription->type == 'taxonomy') {
// rename from long tag name to just 'This forum'
$subscription->name = t('This forum');
}
}
if ($link = $subscription
->build_link()) {
$links['notifications_' . $index] = $link;
}
}
}
}
return $links;
}