Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Using create_session

Quote Reply
Using create_session

I am a complete novice with GForum, and have a problem I suspect many people have had in the past, but I can't find any threads on it.

The problem is that our site has its own Registration and Sign In process, which I'd like to seamlessly integrate with our new Forum software.

I found a plugin (AutoLogin) which I have modified as follows:

sub somecode {
my (@args) = @_;
my $vars = GForum::Plugins->get_plugin_user_cfg('AutoLogin');
my $username_cookie = $vars->{username_cookie};
GForum::Authenticate::auth('valid_session') or $USER = undef;
if (!$USER) {
# Authentication procedure specific to my site here. $firstname, $username, $user_id, etc defined if successfully authenticated
if (defined($firstname)) { # session valid, create forum session
$USER = $username;
# With the above line in I get an error*. Without it user_last_login update (below) works, but user is not authenticated (gets status Guest)
$USER->{user_id} = $user_id;
if (!$USER->{user_last_logon}) {
$USER->{user_first_logon} = 1;
$DB->table('User')->update({ user_last_logon => CORE::time }, { user_id => $USER->{user_id} });
# create_session returns true if a redirect was printed, so we need to return its negation.
return not GForum::Authenticate::auth('create_session');
} else {
Error*: A fatal error has occurred:
Can't use string ("myusername") as a HASH ref while "strict refs" in use at ....
Please enable debugging in setup for more details.

I would be grateful for any help with this!
Quote Reply
Re: [malaneyc] Using create_session In reply to

I'd recommend downloading Gossamer Community which has an Auth_Community plugin that shows how to make Gossamer Forum authenticate off a third party application.



Gossamer Threads Inc.