function _og_notifications_node_options in Organic groups 5.3
Same name and namespace in other branches
- 5.8 og_notifications/og_notifications.module \_og_notifications_node_options()
- 5 og_notifications/og_notifications.module \_og_notifications_node_options()
- 5.7 og_notifications/og_notifications.module \_og_notifications_node_options()
- 6.2 modules/og_notifications/og_notifications.module \_og_notifications_node_options()
- 6 modules/og_notifications/og_notifications.module \_og_notifications_node_options()
Options to display for node subscriptions.
1 call to _og_notifications_node_options()
- og_notifications_notifications in og_notifications/
og_notifications.module - Implementation of hook_notifications().
File
- og_notifications/
og_notifications.module, line 720 - Provide notifications and messaging support for organic groups.
Code
function _og_notifications_node_options($account, $node) {
$options = array();
// If node is a group type and the user is subscribed to this group.
if (og_is_group_type($node->type) && isset($account->og_groups[$node->nid])) {
$options[] = array(
'name' => t('All posts in %group', array(
'%group' => $node->title,
)),
'type' => 'group',
'fields' => array(
'group' => $node->nid,
),
);
foreach (array_filter(variable_get('og_notifications_content_types', array())) as $type) {
$options[] = array(
'name' => t('%type posts in %group', array(
'%group' => $node->title,
'%type' => node_get_types('name', $type),
)),
'type' => 'grouptype',
'fields' => array(
'group' => $node->nid,
'type' => $type,
),
);
}
}
// If node is part of a group user may be subscribed to the node through one
// of the groups.
if ($node->og_groups) {
foreach ($node->og_groups as $index => $gid) {
// Only members get to see subscription options.
if (isset($account->og_groups[$gid])) {
// Content type
$options[] = array(
'name' => t('Posts in group %name', array(
'%name' => $node->og_groups_both[$gid],
)),
'type' => 'group',
'fields' => array(
'group' => $gid,
),
);
$options[] = array(
'name' => t('%type posts in %group', array(
'%group' => $node->og_groups_both[$gid],
'%type' => node_get_types('name', $node->type),
)),
'type' => 'grouptype',
'fields' => array(
'group' => $gid,
'type' => $node->type,
),
);
}
}
}
return $options;
}