Hello,
I need to alter the default drupal_goto after a login without a ReturnTo/gotourl set. I'd prefer it dump them on the homepage, not their user page.

Currently I have a module that overrides the user/ menu item and redirects them to the homepage, but this adds about 800ms to 1s to my login process. Which is currently at 15 seconds due to a complex chained IDP setup. I'm looking for any improvement I can find.

This is where I'm hacking it:
drupal_goto('user/' . $user->uid);

Would the community be open to making this configurable?

I see two options:
1. Configuration for default gotourl. Would need tokens or something for setting uid.
2. Hook to alter the gotourl via another module.

Not asking anyone to do the work, just asking if you are open to it. If so, I'll submit a patch. If not, then I'll maintain my own copy with it just hard coded to .

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nathanlenz created an issue. See original summary.

nathanlenz’s picture

Status: Active » Closed (won't fix)

Never mind, easy enough to do by implementing hook_drupal_goto_alter and changing requests to user/[0-9]{1,11}, replacing with contents of a variable set in the module that implements the hook.

function my_module_drupal_goto_alter(&$path, &$options, &$http_response_code) {

  if (preg_match('/^user\/[0-9]{1,11}$/', $path)) {
    $path = variable_get('my_module_default_login_goto', '<front>');
  }
  
}

This is ok for my situation because I never want anyone to goto the user page, just isn't important because my users are managed elsewhere.

Sneakyvv’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Component: Miscellaneous » Code
Assigned: nathanlenz » Unassigned
Priority: Minor » Normal
Status: Closed (won't fix) » Needs review
FileSize
1.95 KB

I like to reopen this issue as I'm confronted with the same “problem“.

I chose the first solution nathanlenz proposed, a setting in the configuration form.

ryan.gibson’s picture

A slightly different take on the patch. Some adjustments to the original patch to skip the other checks if a user-configured setting has been provided.