Mercurial > defr > drupal > core
diff 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 |
line wrap: on
line diff
--- a/modules/tracker/tracker.module Tue Dec 23 14:29:21 2008 +0100 +++ b/modules/tracker/tracker.module Tue Dec 23 14:30:08 2008 +0100 @@ -1,5 +1,5 @@ <?php -// $Id: tracker.module,v 1.154 2007/12/14 18:08:49 goba Exp $ +// $Id: tracker.module,v 1.154.2.1 2008/04/09 21:11:51 goba Exp $ /** * @file @@ -33,11 +33,11 @@ $items['tracker/all'] = array( 'title' => 'All recent posts', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'access callback' => 'user_is_logged_in', ); - $items['tracker/%user_current'] = array( + $items['tracker/%user_uid_optional'] = array( 'title' => 'My recent posts', - 'access callback' => 'user_is_logged_in', + 'access callback' => '_tracker_myrecent_access', + 'access arguments' => array(1), 'page arguments' => array(1), 'type' => MENU_LOCAL_TASK, ); @@ -46,6 +46,8 @@ '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', ); @@ -55,3 +57,19 @@ ); 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'); +} +