I have a custom file that is my startup page. I would want that when users logout, it redirects to the custom file (home.php) instead of the login page, to which it now redirects.How do I get this done?
You may simply put this following code in Page_Redirecting server event that belongs to the Logout Page:
$url = "home";
v2024.4
// Page Redirecting event
function Page_Redirecting(string &$url): void
{
// Example:
//$url = “your URL”;
$url = “shop”;
}
this gets ignored
I also tried different event:
// User Logged Out event
function User_LoggedOut(string $userName): void
{
//Log(“User Logged Out”);
header(“Location: /shop”);
exit;
}
this redirection worked but user was not logged out
ps:
changing the following in src/LogoutSubscriber.php worked
// Go to login page
$this->redirect($event, UrlFor(“login”));
with
// Go to login page
$this->redirect($event, ‘shop’);