You are here

tracker.module in Drupal 6

Same filename and directory in other branches
  1. 5 modules/tracker/tracker.module
  2. 7 modules/tracker/tracker.module

Enables tracking of recent posts for users.

File

modules/tracker/tracker.module
View source
<?php

/**
 * @file
 * Enables tracking of recent posts for users.
 */

/**
 * Implementation of hook_help().
 */
function tracker_help($path, $arg) {
  switch ($path) {
    case 'admin/help#tracker':
      $output = '<p>' . t('The tracker module displays the most recently added or updated content on your site, and provides user-level tracking to follow the contributions of particular authors.') . '</p>';
      $output .= '<p>' . t("The <em>Recent posts</em> page is available via a link in the navigation menu block and displays new and recently-updated content (including the content type, the title, the author's name, number of comments, and time of last update) in reverse chronological order. Posts are marked updated when changes occur in the text, or when new comments are added. To use the tracker module to follow a specific user's contributions, select the <em>Track</em> tab from the user's profile page.") . '</p>';
      $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@tracker">Tracker module</a>.', array(
        '@tracker' => 'http://drupal.org/handbook/modules/tracker/',
      )) . '</p>';
      return $output;
  }
}

/**
 * Implementation of hook_menu().
 */
function tracker_menu() {
  $items['tracker'] = array(
    'title' => 'Recent posts',
    'page callback' => 'tracker_page',
    'access arguments' => array(
      'access content',
    ),
    'weight' => 1,
    'file' => 'tracker.pages.inc',
  );
  $items['tracker/all'] = array(
    'title' => 'All recent posts',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['tracker/%user_uid_optional'] = array(
    'title' => 'My recent posts',
    'access callback' => '_tracker_myrecent_access',
    'access arguments' => array(
      1,
    ),
    'page arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
  );
  $items['user/%user/track'] = array(
    'title' => 'Track',
    'page callback' => 'tracker_page',
    'page arguments' => array(
      1,
      TRUE,
    ),
    'access callback' => '_tracker_user_access',
    'access arguments' => array(
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'tracker.pages.inc',
  );
  $items['user/%user/track/posts'] = array(
    'title' => 'Track posts',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  return $items;
}

/**
 * Access callback for tracker/%user_uid_optional
 */
function _tracker_myrecent_access($account) {

  // This path is only allowed for authenticated users looking at their own posts.
  return $account->uid && $GLOBALS['user']->uid == $account->uid && user_access('access content');
}

/**
 * Access callback for user/%user/track
 */
function _tracker_user_access($account) {
  return user_view_access($account) && user_access('access content');
}

Functions

Namesort descending Description
tracker_help Implementation of hook_help().
tracker_menu Implementation of hook_menu().
_tracker_myrecent_access Access callback for tracker/%user_uid_optional
_tracker_user_access Access callback for user/%user/track