I am attempting to convert subuser_switch to use masquerade as I think it makes more sense, but I think having the following feature is a must and works better for most projects I have used this on.

 * Implements hook_menu_link_alter().
 * @see subuser_switch_translated_menu_link_alter()
function subuser_switch_menu_link_alter(&$item) {
  // Allow the logout link to be altered.
  if ($item['link_path'] == 'user/logout') {
    $item['options']['alter'] = TRUE;

 * Implements hook_translated_menu_link_alter().
function subuser_switch_translated_menu_link_alter(&$item, $map) {
  // If currently running as a child user change the "Log out" link to
  // "Log out (return)".
  if ($item['href'] == 'user/logout' && !empty($_SESSION['subuser_parent'])) {
    $item['title'] = t('Log out (return)');
    $item['href'] = 'subuser/switch/' . $_SESSION['subuser_parent'];
#1 1146452-link.patch1.12 KBboombatower


boombatower’s picture

Status:Active» Needs review
new1.12 KB

Rough conversion. Still needs setting (or replace current method of additional menu item) and token jazz.

andypost’s picture

Status:Needs review» Needs work

I'm not sure about UX of this - some modules are altering the logout link to implement protection
also this patch needs token support