Making drupal_goto Ignore ?destination=foo
-
16-10-2019 - |
Pergunta
I frequently come across cases in my Drupal 6 sites where a user might encounter my module's pages with the ?destination=foo querystring appended to the URL, from previous interactions on the site. Results of this vary from "inconvenient" to "very aggravating."
The default behavior of drupal_goto()
checks for the destination parameter first, and disregards the arguments to drupal_goto()
if it is present.
Is there a Drupal-native way to use drupal_goto() in a way that ignores destination
?
(Yes, I know I can recreate a version of drupal_goto()
in a utility function, but I would prefer a Drupal-native solution if one exists)
Solução
It's actually quite simple, just unset $_REQUEST['destination']
before you invoke drupal_goto()
.
Outras dicas
Actually, unset($_REQUEST['destination'])
doesn't work for me, but I was able to get it work with this instead: unset($_GET['destination'])
.