I'm using drupal_goto to redirect users on login. Administrators and 'other' are redirected to the dashboard. All works fine but I want to redirect to the dashboard in an administrative overlay. (Path = #overlay=nl/admin/dashboard)
Chrome and Firefox alter the # to %23 so I get a page not found error.

Can this be done?

Here is the function:

 * Implements hook_user_login().
function myModule_user_login(&$edit, $account) {    
  $user_roles = array_intersect(array('other', 'administrator'), array_values($account->roles));
  if (!empty($user_roles)) {
  } else {

1 Answer 1


You need to pass a fragment to drupal_goto() as an option like so:

$options = array('fragment' => 'nl/admin/overlay');
drupal_goto('some-url', $options);

Reference for this can be found on the url() docs page (the docs page for drupal_goto() actually refers you to there as well).

  • With fragment $options = array('fragment' => overlay=admin/dashboard'); it's working properly, TY!
    – JurgenR
    Mar 16, 2012 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.