Tracker hook_perm missed
Yur - December 9, 2007 - 18:04
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | tracker.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs review) |
Description
Answering to "Allow Recent posts only for certain roles?" (http://drupal.org/node/199152) I've found, that there is no hook_perm in tracker.module (Drupal 5.3&5.5).
It cause missing "tracker access" row under Access control page (admin/user/access).
After deep googling, old patch was found, tested and seems to work.
I've insert
/* Implementation of hook_perm() */
function tracker_perm() {
return array('access recent posts');
}before
/**
* Implementation of hook_menu().
*and replace
'callback' => 'tracker_page', 'access' => user_access('access content'),to
'callback' => 'tracker_page', 'access' => (user_access('access content') && user_access('access recent posts')),It works for me, but for sure it need to be tested before patched and committed. Somebody?
P.S. I've attach tracker.module file with code, mentioned above.
| Attachment | Size |
|---|---|
| tracker.module.txt | 5.63 KB |

#1
also replaced line 48:
'callback' => 'tracker_track_user', 'access' => user_access('access content'),to:
'callback' => 'tracker_track_user', 'access' => (user_access('access content') && user_access('access recent posts')),look at if($may_cache) else ->
#2
Hi,
The hook is not working for me.
The /tracker page is still available for anonymous users while I set the access control to only be accessable to admin.
EDIT: This post maked me happy: http://drupal.org/node/199152#comment-654288
It appears there is also a view tracker. That should also be disabled.
It is working now, thanks for the hook!
Greetings,
Martijn
#3
Great fix for a really annoying bug! Thanks. FYI, it also works for 5.7 - patch is attached.
Note, if you have Views enabled, but not tracker, simply disable the "recent posts" View.
#4
This new permission would remove access to the tracker when upgrading 5.x until an admin sets the new permission. This is not something that should happen during a routine bugfix upgrade.
It would be best to start with the current development version.
#5
Reroll.