You are here

function _og_notifications_node_options in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \_og_notifications_node_options()
  2. 5 og_notifications/og_notifications.module \_og_notifications_node_options()
  3. 5.3 og_notifications/og_notifications.module \_og_notifications_node_options()
  4. 6.2 modules/og_notifications/og_notifications.module \_og_notifications_node_options()
  5. 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 486
Subscriptions to content in groups.

Code

function _og_notifications_node_options($account, $node) {

  // If node is a group type
  if (og_is_group_type($node->type)) {
    $options[] = array(
      'name' => t('To all posts in this group'),
      '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 this group', array(
          '%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) {

      // 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 this group', array(
          '%type' => node_get_types('name', $node->type),
        )),
        'type' => 'grouptype',
        'fields' => array(
          'group' => $gid,
          'type' => $node->type,
        ),
      );
    }
  }
  return $options;
}