tracker.module

You are here

  1. 7 modules/tracker/tracker.module
  2. 4.6 modules/tracker.module
  3. 4.7 modules/tracker.module
  4. 5 modules/tracker/tracker.module
  5. 6 modules/tracker/tracker.module
  6. 8 core/modules/tracker/tracker.module

Enables tracking of recent posts for users.

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

File

modules/tracker/tracker.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * Enables tracking of recent posts for users.
  5. */
  6. /**
  7. * Implementation of hook_help().
  8. */
  9. function tracker_help($path, $arg) {
  10. switch ($path) {
  11. case 'admin/help#tracker':
  12. $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>';
  13. $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>';
  14. $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>';
  15. return $output;
  16. }
  17. }
  18. /**
  19. * Implementation of hook_menu().
  20. */
  21. function tracker_menu() {
  22. $items['tracker'] = array(
  23. 'title' => 'Recent posts',
  24. 'page callback' => 'tracker_page',
  25. 'access arguments' => array('access content'),
  26. 'weight' => 1,
  27. 'file' => 'tracker.pages.inc',
  28. );
  29. $items['tracker/all'] = array(
  30. 'title' => 'All recent posts',
  31. 'type' => MENU_DEFAULT_LOCAL_TASK,
  32. );
  33. $items['tracker/%user_uid_optional'] = array(
  34. 'title' => 'My recent posts',
  35. 'access callback' => '_tracker_myrecent_access',
  36. 'access arguments' => array(1),
  37. 'page arguments' => array(1),
  38. 'type' => MENU_LOCAL_TASK,
  39. );
  40. $items['user/%user/track'] = array(
  41. 'title' => 'Track',
  42. 'page callback' => 'tracker_page',
  43. 'page arguments' => array(1, TRUE),
  44. 'access callback' => '_tracker_user_access',
  45. 'access arguments' => array(1),
  46. 'type' => MENU_LOCAL_TASK,
  47. 'file' => 'tracker.pages.inc',
  48. );
  49. $items['user/%user/track/posts'] = array(
  50. 'title' => 'Track posts',
  51. 'type' => MENU_DEFAULT_LOCAL_TASK,
  52. );
  53. return $items;
  54. }
  55. /**
  56. * Access callback for tracker/%user_uid_optional
  57. */
  58. function _tracker_myrecent_access($account) {
  59. // This path is only allowed for authenticated users looking at their own posts.
  60. return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content');
  61. }
  62. /**
  63. * Access callback for user/%user/track
  64. */
  65. function _tracker_user_access($account) {
  66. return user_view_access($account) && user_access('access content');
  67. }