Problem/Motivation
We needed a way to modify the default $redirect_url in certain situations. In our example, site admins need to be redirected to an admin-only URL upon auto-logout, whereas "regular" authenticated users will continue to the default $redirect_url.
Proposed resolution
We propose adding a hook_autologout_redirect_url_alter to allow the customisation of the $redirect_url (and the $redirect_query, if necessary).
A patch to add this functionality is attached -- can someone please review, thank you.
This is my first patch in Drupal, so please let me know if I did anything wrong.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | _autologout-add-hook-customise-redirect-url-2863161.patch | 1.34 KB | deadpoet |
Comments
Comment #2
deadpoet commentedComment #3
geoffreyr commented+1 for #2 - we've been using it for a while now and it works fine.
Comment #4
saurabh-chugh commentedI have tested and #2 is working fine. Thanks @44sunsets
Comment #5
deaom commentedThis line of codedrupal_alter('autologout_redirect_url', $redirect_url, $redirect_query);breaks the login altogether. I applied the patch, it appliesMy bad, did not notice this is for drupal 7. The patch applies.
Comment #6
deaom commentedComment #7
bzoks commentedI applied patch at #2 and successfully tested provided hook. Marking as RTBC.
Comment #9
boshtian commented