function notifications_user_notifications_object_node in Notifications 7
Implementation of hook_notifications_object_node()
File
- notifications_user/
notifications_user.module, line 143 - Notifications module - User subscriptions tabs
Code
function notifications_user_notifications_object_node($op, $node, $account = NULL) {
switch ($op) {
case 'subscription types':
return array(
'user_content',
'user_content_type',
);
case 'subscriptions':
// Return available subscription options for this node and this user account
$options = array();
$author = user_load($node->uid);
$author_name = check_plain(format_username($author));
// Node author subscriptions
if (notifications_content_type_enabled($node->type, 'user_content')) {
$options[] = notifications_subscription('user_content')
->set_author($node->uid)
->set_name(t('Posts by @name', array(
'@name' => $author_name,
)));
}
// Subscribe to content type by author
if (notifications_content_type_enabled($node->type, 'user_content_type')) {
$options[] = notifications_subscription('user_content_type')
->set_node($node)
->set_name(t('@type posts by @name', array(
'@name' => $author_name,
'@type' => node_type_get_name($node),
)));
}
return $options;
break;
}
}