You are here

function og_notifications_user_page in Organic groups 6.2

Same name and namespace in other branches
  1. 5.8 og_notifications/og_notifications.module \og_notifications_user_page()
  2. 5 og_notifications/og_notifications.module \og_notifications_user_page()
  3. 5.3 og_notifications/og_notifications.module \og_notifications_user_page()
  4. 5.7 og_notifications/og_notifications.module \og_notifications_user_page()
  5. 6 modules/og_notifications/og_notifications.module \og_notifications_user_page()

Menu callback: Display the user subscription management forms.

Parameters

Object $account: User object of the user whose page is to be displayed.

2 string references to 'og_notifications_user_page'
og_notifications_menu in modules/og_notifications/og_notifications.module
Implementation of hook_menu().
og_notifications_notifications in modules/og_notifications/og_notifications.module
Implementation of hook_notifications().

File

modules/og_notifications/og_notifications.pages.inc, line 14
Group subscriptions management methods.

Code

function og_notifications_user_page($account = NULL) {
  global $user;
  $account = $account ? $account : $user;
  $groups = array();
  foreach ($account->og_groups as $gid => $group) {

    // Handle unpublished groups.
    if ($group['status']) {
      $groups[$gid] = $group['title'];
    }
  }
  if (!empty($groups)) {
    $output = drupal_get_form('og_notifications_add_form', $account, $groups);
  }
  else {

    // If there are no active groups available do not show either form. This
    // also applies to unpublished groups even if related subscriptions are
    // still active.
    $output = t('There are no active group subscriptions available.');
  }
  return $output;
}