Page 1 of 1

Redirect after signOut

Posted: 2019-12-07 01:40
by bdurfee
Using the global hooks file, we can redirect after signIn just by returning a URL.

Is there a way to redirect after signOut?

Re: Redirect after signOut

Posted: 2019-12-11 16:04
by onoehring
Hi bdurfee,

actually, this should be easy.
Look at /index.php and look for the line

Code: Select all

if(isset($_GET['signOut']))
Here you should be able to do your stuff.

My index.php looks like this now ... see the include line. There I handle some logging once the user logges out - so you could simply use a php header to redirect the user to somewhere else.

Code: Select all

<?php
	$currDir = dirname(__FILE__);
	define('HOMEPAGE', true);
	include("{$currDir}/defaultLang.php");
	include("{$currDir}/language.php");
	include("{$currDir}/lib.php");

	$x = new DataList;
	$x->TableTitle = $Translation['homepage'];

	// according to provided GET parameters, either log out, show login form (possibly with a failed login message), or show homepage
	if(isset($_GET['signOut'])) {

include("{$currDir}/hooks/loguserout.php");

		logOutUser();
		redirect("index.php?signIn=1");
	} elseif(isset($_GET['loginFailed']) || isset($_GET['signIn'])) {
		if(isset($_GET['loginFailed'])) @header('HTTP/1.0 403 Forbidden');
		include("{$currDir}/login.php");
	} else {
		include("{$currDir}/home.php");
	}
Olaf