I need the user,opening a certain page of my site (www.foo.com/page_to_visit), to login and then go to the requested page, so I set up an hook_menu for this specific page and a callback. In the callback I added this code which works
drupal_goto('user', array('query'=>drupal_get_destination()))
but if the url contains query strings (www.foo.com/page_to_visit?id=12&od=12) they are removed. I mean that, after login, the user gets redirected to www.foo.com/page_to_visit instead of www.foo.com/page_to_visit?id=12&od=12. How do I avoid this behaviour?
UPDATE: Drupl_goto has something supporting this. Produced this code, following documentation
$args = array(); $params = $_GET; $args[] = $params['q']; unset($params['q'], $params['destination']); if (count($params) > 1) { $pippo['query'] = $params; $args[] = $pippo; } drupal_goto('user', array('query'=>$args)); $args results in ---> Array ( [0] => page_to_visit [1] => Array ( [query] => Array ( [id] => 12 [od] => 12 ) ) )
The result is odd for the redirect looks like http://www.foo.com/user?0=page_to_visit&1[query][id]=12&1[query][od]=12
Sponsored by SupremePR