comparison modules/tracker/tracker.module @ 5:2427550111ae 6.2

Drupal 6.2
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:08 +0100
parents c1f4ac30525a
children
comparison
equal deleted inserted replaced
4:d94886ac61a0 5:2427550111ae
1 <?php 1 <?php
2 // $Id: tracker.module,v 1.154 2007/12/14 18:08:49 goba Exp $ 2 // $Id: tracker.module,v 1.154.2.1 2008/04/09 21:11:51 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Enables tracking of recent posts for users. 6 * Enables tracking of recent posts for users.
7 */ 7 */
31 'file' => 'tracker.pages.inc', 31 'file' => 'tracker.pages.inc',
32 ); 32 );
33 $items['tracker/all'] = array( 33 $items['tracker/all'] = array(
34 'title' => 'All recent posts', 34 'title' => 'All recent posts',
35 'type' => MENU_DEFAULT_LOCAL_TASK, 35 'type' => MENU_DEFAULT_LOCAL_TASK,
36 'access callback' => 'user_is_logged_in',
37 ); 36 );
38 $items['tracker/%user_current'] = array( 37 $items['tracker/%user_uid_optional'] = array(
39 'title' => 'My recent posts', 38 'title' => 'My recent posts',
40 'access callback' => 'user_is_logged_in', 39 'access callback' => '_tracker_myrecent_access',
40 'access arguments' => array(1),
41 'page arguments' => array(1), 41 'page arguments' => array(1),
42 'type' => MENU_LOCAL_TASK, 42 'type' => MENU_LOCAL_TASK,
43 ); 43 );
44 44
45 $items['user/%user/track'] = array( 45 $items['user/%user/track'] = array(
46 'title' => 'Track', 46 'title' => 'Track',
47 'page callback' => 'tracker_page', 47 'page callback' => 'tracker_page',
48 'page arguments' => array(1, TRUE), 48 'page arguments' => array(1, TRUE),
49 'access callback' => '_tracker_user_access',
50 'access arguments' => array(1),
49 'type' => MENU_LOCAL_TASK, 51 'type' => MENU_LOCAL_TASK,
50 'file' => 'tracker.pages.inc', 52 'file' => 'tracker.pages.inc',
51 ); 53 );
52 $items['user/%user/track/posts'] = array( 54 $items['user/%user/track/posts'] = array(
53 'title' => 'Track posts', 55 'title' => 'Track posts',
54 'type' => MENU_DEFAULT_LOCAL_TASK, 56 'type' => MENU_DEFAULT_LOCAL_TASK,
55 ); 57 );
56 return $items; 58 return $items;
57 } 59 }
60
61 /**
62 * Access callback for tracker/%user_uid_optional
63 */
64 function _tracker_myrecent_access($account) {
65 // This path is only allowed for authenticated users looking at their own posts.
66 return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content');
67 }
68
69 /**
70 * Access callback for user/%user/track
71 */
72 function _tracker_user_access($account) {
73 return user_view_access($account) && user_access('access content');
74 }
75