On Sunday 01 June 2008, Moshe Weitzman wrote:
arg() checking is discouraged in modern drupal for this very reason. each drupal release we have been able to get rid of more of them in core and with the D6 menu system, I really doubt we need any of these calls to arg(). contrib modules that use arg() for access control should refactor and let the menu system handle access control.
your workaround looks fine if it works and has no side effects. needs testing.
It looked like it was working in most cases, but there is a certain case where it fails. If user with uid==1 (admin) is browsing the site, running: <?php menu_set_active_item('user/2'); if (!_menu_item_is_accessible(menu_get_active_item())) { drupal_access_denied(); } ?> gets me access denied every time. I tried to follow the code using a debugger, but can't get my head around the structure of $menu. Any idea how to get the access checking results correctly here? (btw, this is Drupal 5.x) -- Yuval Hager [T] +972-77-341-4155 [@] yuval@avramzon.net