You are here

function notifications_content_page_author in Notifications 5

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

User subscriptions to content types

2 string references to 'notifications_content_page_author'
notifications_content_menu in notifications_content/notifications_content.module
Implementation of hook_menu_()
notifications_content_notifications in notifications_content/notifications_content.module
Implementation of hook_notifications()

File

notifications_content/notifications_content.module, line 577
Subscriptions to content events

Code

function notifications_content_page_author($account = NULL) {
  global $user;
  if (!isset($account)) {
    $account = $user;
  }

  // List of all subscribed node types
  $subscriptions = notifications_get_subscriptions(array(
    'type' => 'author',
    'event_type' => 'node',
    'uid' => $account->uid,
  ), array(
    'author' => NULL,
  ), TRUE, 'value', NOTIFICATIONS_CONTENT_PAGER);
  if (!$subscriptions) {
    $output = t('There are no active author subscriptions.');
  }
  else {

    // Build author list
    $list = array();
    $result = db_query("SELECT uid, name FROM {users} WHERE uid IN (" . implode(',', array_keys($subscriptions)) . ')');
    while ($author = db_fetch_object($result)) {
      $list[$author->uid] = theme('username', $author);
    }
    $defaults = array(
      'type' => 'author',
      'event_type' => 'node',
    );

    //$output = drupal_get_form('notifications_content_form', $account, $subscriptions, $list, 'author', t('Author'), $defaults);
    $options = array(
      'title' => t('Author'),
    );
    $output = drupal_get_form('notifications_user_form', $account, 'author', $subscriptions, $list, $defaults, $options);
    $output .= theme('pager', NULL, NOTIFICATIONS_CONTENT_PAGER);
  }
  return $output;
}