Redirect to Referring Page after Login

Re: [Perchpole] Redirect to Referring Page after Login

Hi Perch,

There is a website membership function that can be used to redirect a user after they have logged in back to the previous page they were on. If you add this code to pages that you want users to be redirected back to:

<?php
setPrefixedCookie('lastUrl', thisPageUrl());
?>


This needs to be added after you have loaded the viewer functions, but if your redirecting users to the login page, it will need to be before that. Also on some servers you will need to add this before the header of the webpage is created.

This will override the WEBSITE_LOGIN_POST_LOGIN_URL global setting in the websiteMembership plugin, and redirect the user back to the page this code is on after log in.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Redirect to Referring Page after Login

Hi, Greg -

Thanks for this. It's perfect and so simple!

All those hours I wasted searching the internet......!

;0)

Perch