function masquerade_menu_alter in Masquerade 7
Same name and namespace in other branches
- 6 masquerade.module \masquerade_menu_alter()
Implements hook_menu_alter().
We need to add a token to the Masquerade paths to protect against CSRF attacks. Since menu items in Drupal do not support dynamic elements these tokens need to be added during rendering via masquerade_translated_menu_link_alter(). Set the 'alter'-option to TRUE to make sure the links get passed through masquerade_translated_menu_link_alter.
File
- ./
masquerade.module, line 167 - The masquerade module allows administrators to masquerade as other user.
Code
function masquerade_menu_alter(&$items) {
$default_test_user = _masquerade_user_load(variable_get('masquerade_test_user', ''));
if (isset($default_test_user->uid)) {
$items['masquerade/switch/' . $default_test_user->uid]['options']['alter'] = TRUE;
}
$items['masquerade/switch/%']['options']['alter'] = TRUE;
$items['masquerade/unswitch']['options']['alter'] = TRUE;
}