diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-04-23 20:01:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-04-23 20:01:56 +0000 |
commit | 21576021bfe440a0a02b0c179440f00e7182d321 (patch) | |
tree | acc3e15e529a4d07827992561dc8053360f61e35 /modules/tracker | |
parent | 63406e5268e564acb83078eb3beb1abdfefee0ec (diff) | |
download | brdo-21576021bfe440a0a02b0c179440f00e7182d321.tar.gz brdo-21576021bfe440a0a02b0c179440f00e7182d321.tar.bz2 |
- Patch #249546 by pwolanin: rip menu access inheritance -- was already committed to D6.
Diffstat (limited to 'modules/tracker')
-rw-r--r-- | modules/tracker/tracker.module | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index 489160f96..e11d8a983 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -33,11 +33,11 @@ function tracker_menu() { $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 @@ function tracker_menu() { '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 @@ function tracker_menu() { ); 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'); +} + |