Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need to write a php snippit or something... that does the following:
If you login from the front page login block, re-direct to the front page (currently goes to user page)
if you login from any page other than the front page, preserve destination.
I know i can use an elseif statement for this but I don't have any idea how to say "if front" or do the preserve destination bit.....
Any guidance?
Rebecca
Comments
Comment #1
mithy CreditAttribution: mithy commentedYou can set to always preserve destination and then unset it for certain cases:
unset($_GET['destination'])
Comment #2
beckyjohnson CreditAttribution: beckyjohnson commentedOK, That sounds interesting. Do I have to write the($_GET['destination']) in function?
Rebecca
Comment #3
mithy CreditAttribution: mithy commentedI do not understand what you mean exactly. Unset is a function. You have to use it in a snippet in the condition where you do not want to preserve the destination.
Comment #4
beckyjohnson CreditAttribution: beckyjohnson commentedI was thinking about this and what i don't really understand is why preserve destination doesn't work in the first place, on the front page. If you login from the front page, it takes you to the user page, and doesn't leave you on the front page..... ugh