You are here

function notifications_content_page_author in Notifications 6.2

Same name and namespace in other branches
  1. 5 notifications_content/notifications_content.module \notifications_content_page_author()
  2. 6 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.pages.inc, line 123
Subscriptions to content events

Code

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

  // List of all author subscriptions, and build author list with the same query
  $subscriptions = $list = array();
  $sql = "SELECT n.*, f.intval, u.name FROM {notifications} n INNER JOIN {notifications_fields} f ON f.sid = n.sid INNER JOIN {users} u ON u.uid = f.intval ";
  $sql .= " WHERE n.uid = %d AND n.type = 'author'";
  $result = pager_query($sql, NOTIFICATIONS_CONTENT_PAGER, 0, NULL, $account->uid);
  while ($subs = db_fetch_object($result)) {
    $author = (object) array(
      'uid' => $subs->intval,
      'name' => $subs->name,
    );
    $list[$author->uid] = theme('username', $author);
    $subs->fields['author'] = $subs->intval;
    $subscriptions[$subs->sid] = $subs;
  }
  if (!$subscriptions) {
    $output = t('There are no active author subscriptions.');
  }
  else {
    $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;
}