How to redirect user-login.php to specific page

Hi

I assume it is an easy task for experienced users, but unfortunately not for me. In the Website membership I want to redirect to a specific webpage after login. I have inserted the specific url (i.e. https://www........) of the page I want to redirect the user to, instead the "lastUrl" in the user-login.php file (as seen below), but it does not work. It always sends me back to the first page of the website, not even on the last referring page 

// save url of referring page so we can redirect user there after login
  // if (!getPrefixedCookie('lastUrl')) { setPrefixedCookie('lastUrl', @$_SERVER['HTTP_REFERER'] ); }

 Kind regards

Andreas Lazaris

By Steve99 - March 8, 2019

Hi,

On line 18 and 19 in the v1.13 website membership plugin php file you'll find the following:

// After login, user gets redirected to the last page they were on (if defined), the url below, or to /
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = PREFIX_URL.'/yourRedirectAfterLoginPageHere.php';

That sets the page to redirect the user to after login, and you'll want to keep that snippet of code you posted from the login page commented out as you do.

Hope this helps!

Best,
Steve

By andreasml - March 9, 2019

Hi Steve

Thank you. I changed the

yourRedirectAfterLoginPageHere.php

to the url I wanted to redirect the user to and it worked!

But, what if i wanted to redirect the user to the last page he/she was on. How will i do it? Is it so by default or should i need to change/add something?

Just to note again that by leaving the default option, 

$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']  = PREFIX_URL.'/';

it redirected user to the first page of the website.

Regards,

Andreas Lazaris

By andreasml - March 11, 2019

Hi Steve

It was really easy!

Thanks

Andreas