I would like to ask that there be a option added to Drupal-7 that allows an administrator to set the system to redirect back to the page the user was on when they click the logout link, not to the front page?

If posable could this also be added to the next edition of Drupal 6.x?

CommentFileSizeAuthor
#5 drupal.custom-user-logout.patch2.82 KBsun

Comments

RobertPope’s picture

can you create a page-logout.tpl.php and then direct it where you want to go?

aaronmchale’s picture

Thanks, however I want the user to be redirected back to the page they were on when they clicked on the logout link?

RobertPope’s picture

isn't the reffering URL available as a variable? can't you just redirect back there? I thinks it's in the DOM

aaronmchale’s picture

Sorry, In the what?

sun’s picture

Title: Redirect on Logout » Allow custom logout page
Status: Active » Needs review
StatusFileSize
new2.82 KB

Yes, that's an often needed customization. Let's add this simple bit to core.

aaronmchale’s picture

Where about do I put that patch?

RobertPope’s picture

document object model - anyway the patch as I see it will allow you to select your logout page - but not necessarily have it be the last one they were on.

sun’s picture

Assigned: Unassigned » sun

@roberttwobears: As mentioned in IRC, redirecting back to the originating page is not possible, because authenticated users usually log out from pages that are accessible to authenticated users only. So your users would get a "403 Access denied." page after logging out. There is no way in the current menu system that would allow conditional page redirects based on the requested path and the current user's permissions.

aaronmchale’s picture

Assigned: sun » Unassigned

Thanks, I'm not new to Drupal, but I'm new to patches. Where exactly is that module located because I can't find it in the module directory (/module/)?

sun’s picture

Assigned: Unassigned » sun
aaronmchale’s picture

In what directory should I put a patch file in (/)?

int’s picture

azz, no.. this patch is to patch one file(replace somes string in one file) and not to add this file to one directory..

See in de documentation in drupal.org you will have everything...

http://drupal.org/patch
http://drupal.org/node/367392
http://drupal.org/node/323498

aaronmchale’s picture

Oh, ok, sorry i'm new to patches.

aaronmchale’s picture

Windows doesn't support patch files so the command prompt won't let me do what I need to do to get the patch to work. What can I do?

int’s picture

Apply patches on Windows
http://drupal.org/node/60179

aaronmchale’s picture

Thanks

aaronmchale’s picture

Status: Needs review » Fixed
sun’s picture

Status: Fixed » Needs review

Well, was that a confirmation of the type "cool, it works"? If so, "reviewed & tested by community" is the proper status.

calebgilbert’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed:

1. Patch apples
2. Patch code appears up to Drupal coding standards
3. Manual functionality testing passes - works as advertised
4. Simpltest that was added via patch also works as advertised
5. +1 on the functionality

moshe weitzman’s picture

Personally, I think this is a bit specialized for core. Soon well have "page after registration" and "page after profile edit and so on". This is trivial to do in contrib - thats my preference.

dries’s picture

I agree with Moshe. Either we extend this functionality to some additional pages (e.g. registration) or we do this in contrib. I'd vote for the latter.

tstoeckler’s picture

Couldn't this be done by modifying actions & triggers?
I have always wondered why the redirect action is not available to the logout trigger. If you set a page which gives the freshly logged out user a 403, well then it's your fault. I really don't see any reason not to. Anything else proposed (upon registration, upon update of user profile) is already possible with actions and triggers (although I didn't actually test to see if it works, but I'm assuming that).

catch’s picture

Status: Reviewed & tested by the community » Needs review

If triggers and actions could be used for this, that'd be a lot more flexible for the other feature requests. Moving back to CNR since this needs more discussion.

sun’s picture

Status: Needs review » Closed (duplicate)

Sorry, I obviously forgot to follow up in this issue. #43483: Add trigger/action for custom after-register, after-login and after-logout events dates back to 2006, and asks not only for a configurable "after-logout" page, but also for configurable "after-register" and "after-login" pages. For that sake, those options would also be located on the user settings page (instead of the site information settings as in this patch).

Doing this via triggers/actions sounds like awesome voodoo to me, especially, because one could add all sorts of other stuff.

Thanks for the reviews. See you over there.

aaronmchale’s picture

Sorry, I'v been away from this issue for a long time. I worked out that you can set a URL Alias from logout to user/logout in Drupal-6 or earlier, but it has to be done in the database, however, this allows you to logout to a specific URL by using ?destination=... This is used in the logon block, so there would be some way of determining the URL of the page the user logs in from, this could be applied here, does anyone know the script that is used to achieve this on the logon block?

aaronmchale’s picture

Status: Closed (duplicate) » Closed (fixed)

I think this issue is closed now, one way around this problem, I discovered, is to give the path /logout a url /user/logout, this allows for the /user/logout?destination=/...