You are here

function notifications_ui_page_user_add in Notifications 6.4

Same name and namespace in other branches
  1. 6 notifications_ui/notifications_ui.pages.inc \notifications_ui_page_user_add()
  2. 6.2 notifications_ui/notifications_ui.pages.inc \notifications_ui_page_user_add()
  3. 6.3 notifications_ui/notifications_ui.pages.inc \notifications_ui_page_user_add()

User add subscription

1 string reference to 'notifications_ui_page_user_add'
notifications_ui_menu in notifications_ui/notifications_ui.module
Implementation of hook_menu()

File

notifications_ui/notifications_ui.pages.inc, line 10
User pages for User Interface for subscriptions modules

Code

function notifications_ui_page_user_add($account, $type = NULL) {
  drupal_set_title(t('Add subscription'));
  if ($type && notifications_ui_access_user_add($account, $type)) {
    $subscription = notifications_build_subscription($type);
    $subscription
      ->set_account($account);
    return drupal_get_form('notifications_subscription_add_form', $subscription, "user/{$account->uid}/notifications");
  }
  else {
    foreach (notifications_ui_subscription_types() as $key => $type) {
      if (notifications_ui_access_user_add($account, $key)) {
        $options[] = array(
          'title' => $type['title'],
          'href' => "user/{$account->uid}/notifications/add/{$key}",
          'description' => !empty($type['description']) ? $type['description'] : '',
        );
      }
    }
    return theme('notifications_ui_add_list', $options);
  }
}