Gossamer Forum
Home : Products : Others : Gossamer Community :

Redirect on Log Out

Quote Reply
Redirect on Log Out
Can this be done? Is it possible to have the user redirected to the home page on log out rather than back to the log in page?

I've tried ="<%path_cgi_url%>?do=user_logout;url=http://www.myhomepage.com" but it doesn't work.

Unsure
Quote Reply
Re: [MJB] Redirect on Log Out In reply to
You need to modify the plugin to change where it will redirect to. Look for where it uses 'comm_logout_url'.

Adrian
Quote Reply
Re: [brewt] Redirect on Log Out In reply to
In Reply To:
modify the plugin

What plugin? I don't have any installed in community.

Do you mean the Auth_Community plugins that I am using with Links & Forum?
Quote Reply
Re: [MJB] Redirect on Log Out In reply to
Yeah, the Auth_Community plugins.

Adrian
Quote Reply
Re: [MJB] Redirect on Log Out In reply to
Hi,
where is the variable
comm_logout_url
defined?

I can not find it in the Auth_Community plugins?

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Redirect on Log Out In reply to
Why do you need this? It would be somewhere in your "private" folder for GComm.

Its actually held in this function (found in /lib/Community.pm);

Code:
sub comm_logout_url {
# -------------------------------------------------------------------
my $url = $CFG->{path_cgi_url} . '?do=user_logout';
if ($IN->param('t')) {
my $set = $IN->escape($IN->param('t'));
$url .= ";t=$set";
}
return $url;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Redirect on Log Out In reply to
Hi Andy,
I found this code, too,
but I don't know how to redirect the user after log out to something like a thank you page page instead of a community login.

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Redirect on Log Out In reply to
Hi,

I think what you are looking for, is in /lib/Community/Web/User.pm.

Code:
sub user_logout {
# -------------------------------------------------------------------
require Community::User;
my $session = $IN->cookie($CFG->{session_cookie_name_session});
my $cookies;
if ($session) {
my $user = comm_auth_session($session);
comm_delete_session($session);
$cookies = session_cookies('', '-1y');
if ($user) {
push @$cookies, Community::User::cuser_logout($user);
}
}
return ('user_logout.html', { session_cookie_name_user => '' }, {}, $cookies);
}

It may be as simple as changing it to:

Code:
sub user_logout {
# -------------------------------------------------------------------
require Community::User;
my $session = $IN->cookie($CFG->{session_cookie_name_session});
my $cookies;
if ($session) {
my $user = comm_auth_session($session);
comm_delete_session($session);
$cookies = session_cookies('', '-1y');
if ($user) {
push @$cookies, Community::User::cuser_logout($user);
}
}
print "Location: http://www.url.com/to_go_to.bla \n\n";
}

However, looking at it - you may have a problem, as it looks like the cookies are set (or more to the point "cleared out", so that they are fully logged out).

The better option may well be to just edit:

user_logout.html

...and put in an auto-redirect (using javascript) on that page, which goes to the page you want.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Redirect on Log Out In reply to
Hi Andy,
It's time for a break. Spent to much time with pc-work.

Certainly it's better to modify user_logout.html ;-)

Matthias

Matthias
gpaed.de