function notifications_content_notifications_object_node in Notifications 6.4
Same name and namespace in other branches
- 7 notifications_content/notifications_content.module \notifications_content_notifications_object_node()
Implementation of hook_notifications_object_node()
File
- notifications_content/
notifications_content.module, line 392 - Subscriptions to content events
Code
function notifications_content_notifications_object_node($op, $node, $account = NULL) {
switch ($op) {
case 'conditions':
return array(
'nid' => $node->nid,
'type' => $node->type,
'author' => $node->uid,
);
case 'subscriptions':
// Return available subscription options for this node and this user account
$options = array();
// Thread
if (notifications_content_type_enabled($node->type, 'thread')) {
$options[] = array(
'name' => t('This post'),
'type' => 'thread',
'fields' => array(
'nid' => $node->nid,
),
);
}
// Content type subscriptions
if (notifications_content_type_enabled($node->type, 'nodetype')) {
$options[] = array(
'name' => t('Posts of type @type', array(
'@type' => notifications_content_type_name($node->type),
)),
'type' => 'nodetype',
'fields' => array(
'type' => $node->type,
),
);
}
// Node author subscriptions
if (notifications_content_type_enabled($node->type, 'author')) {
$options[] = array(
'name' => t('Posts by @name', array(
'@name' => _notifications_content_node_username($node),
)),
'type' => 'author',
'fields' => array(
'author' => $node->uid,
),
);
}
// Subscribe to content type by author
if (notifications_content_type_enabled($node->type, 'typeauthor')) {
$options[] = array(
'name' => t('@type posts by @name', array(
'@name' => _notifications_content_node_username($node),
'@type' => notifications_content_type_name($node->type),
)),
'type' => 'typeauthor',
'fields' => array(
'author' => $node->uid,
'type' => $node->type,
),
);
}
return $options;
break;
}
}