Drupal Answers Asked by lbogdan on January 15, 2021
I’d like users registering on my website are redirected to the page where they clicked the “create account” button which is in a modal.
First, I tried to redirect to an absolute url
I tried
$form_state->setRedirect($myUrl);
I tried
$_REQUEST['destination'] = '<front>';
I tried this too :
$response = new DrupalCoreRoutingTrustedRedirectResponse('http://www.google.be');
$form_state->setResponse($response);
I’m always redirected to /user/[uid]/edit
You can accomplish this with the Rules Link module, and using the php variable php variables %server[HTTP_REFERER]
Or, without having to enable php in rules, you can use a custom 'previous page' token, explained in this drupal.org issue.
Create a rule that triggers when the link is clicked, stores the previous page a a variable, do some other actions you want and at the end a redirect action to that previous page variable.
Answered by Yuri on January 15, 2021
You could use Rules module to achieve that..
Answered by dharma on January 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP