diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-06 12:47:20 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-06 12:47:20 +0000 |
commit | 9307321817e60ad649a6e166ddaacc7307b333e7 (patch) | |
tree | 801f110956a679861372241839c977ab0cc648ad | |
parent | c3685d60f70b6a37bb5a47f92fb35c00364a95df (diff) | |
download | brdo-9307321817e60ad649a6e166ddaacc7307b333e7.tar.gz brdo-9307321817e60ad649a6e166ddaacc7307b333e7.tar.bz2 |
#148677 by pwolanin: set active menu item on 403/404 pages (and on the user page)
-rw-r--r-- | includes/common.inc | 6 | ||||
-rw-r--r-- | includes/menu.inc | 13 | ||||
-rw-r--r-- | modules/user/user.module | 2 |
3 files changed, 19 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index 2110edc4e..b0cd37a9f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -340,6 +340,9 @@ function drupal_not_found() { $path = drupal_get_normal_path(variable_get('site_404', '')); if ($path && $path != $_GET['q']) { + // Set the active item in case there are tabs to display, or other + // dependencies on the path. + menu_set_active_item($path); $return = menu_execute_active_handler($path); } @@ -365,6 +368,9 @@ function drupal_access_denied() { $path = drupal_get_normal_path(variable_get('site_403', '')); if ($path && $path != $_GET['q']) { + // Set the active item in case there are tabs to display, or other + // dependencies on the path. + menu_set_active_item($path); $return = menu_execute_active_handler($path); } diff --git a/includes/menu.inc b/includes/menu.inc index 95fe9da69..db3d1e6ad 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1240,7 +1240,18 @@ function menu_get_active_menu_name() { return menu_set_active_menu_name(); } -function menu_set_active_item() { +/** + * Set the active path, which determines which page is loaded. + * + * @param $path + * A Drupal path - not a path alias. + * + * Note that this may not have the desired effect unless invoked very early + * in the page load, such as during hook_boot, or unless you call + * menu_execute_active_handler() to generate your page output. + */ +function menu_set_active_item($path) { + $_GET['q'] = $path; } /** diff --git a/modules/user/user.module b/modules/user/user.module index 22c872af7..ca8dc1c7a 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1138,7 +1138,7 @@ function user_set_authmaps($account, $authmaps) { function user_page() { global $user; if ($user->uid) { - $_GET['q'] = 'user/'. $user->uid; + menu_set_active_item('user/'. $user->uid); return menu_execute_active_handler(); } else { |