Hi,
I want to overwrite an existing cookie when someone logs out from the forum. I try to use a plugin with a hook after "logout".
The following isn't working.
# ==================================================================
use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;
use GT::CGI;
use GT::CGI::Cookie;
# Inherit from base class for debug and error methods
@Plugins::GForum::CookieOut::ISA = qw(GT::Base);
# Your code begins here! Good Luck!
# PLUGIN HOOKS
# ===================================================================
sub loeschen {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'logout'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my (@args) = @_;
# Do something useful here
my $in = new GT::CGI;
my $c = new CGI::Cookie(-name => 'lh_username', -value => '');
print $in->header( -cookie => $c );
return @args;
}
# Always end with a 1.
1;
Can someone give me a hint?
This from the forum-help doesn't worked at all:
------------------
To set a cookie:
$c = $cgi->cookie (-name => 'foo', -value => 'bar')
You would then set the cookie by passing it to the header function:
print $in->header ( -cookie => $c );
--------------------
I want to overwrite an existing cookie when someone logs out from the forum. I try to use a plugin with a hook after "logout".
The following isn't working.
Code:
package Plugins::GForum::CookieOut; # ==================================================================
use strict;
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use GForum qw/$IN $DB $CFG/;
use GT::CGI;
use GT::CGI::Cookie;
# Inherit from base class for debug and error methods
@Plugins::GForum::CookieOut::ISA = qw(GT::Base);
# Your code begins here! Good Luck!
# PLUGIN HOOKS
# ===================================================================
sub loeschen {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'logout'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my (@args) = @_;
# Do something useful here
my $in = new GT::CGI;
my $c = new CGI::Cookie(-name => 'lh_username', -value => '');
print $in->header( -cookie => $c );
return @args;
}
# Always end with a 1.
1;
Can someone give me a hint?
This from the forum-help doesn't worked at all:
------------------
To set a cookie:
$c = $cgi->cookie (-name => 'foo', -value => 'bar')
You would then set the cookie by passing it to the header function:
print $in->header ( -cookie => $c );
--------------------