Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Current user

Quote Reply
Current user
I've written some scripts to run extra pages on my forum. I'm having a problem with getting the username of the current user. The scripts are run through the forum so that they only give access to members of a group - so I know that the people using the page must be logged on.

I have

use GForum qw/:forum :user $IN $DB $CFG $USER $GUEST/;
GForum::init ('/home/sites/site4/web/perl/admin'); # Required

at the top of the script and


within the sub. But $USER->{'user_username'} does not exist for some people.

Any suggestions?

I'm also using <%if user_username eq $Member%>stuff<%endif%> and they don't see the stuff so I can only guess that user_username really isn't set.

I've tried using $USER->{'current_user_username'} in the script but that doesn't work.
Quote Reply
Re: [afinlr] Current user In reply to
If $USER isn't set after calling authenticate(), it means the user could not be authenticated. Perhaps it comes from not passing along the session ID in the URL? Try logging in without cookies, and see if it fails to authenticate you. If so, where you have to link to your.cgi, change it to your.cgi?<%hidden_query%> - that'll pass along session=..... which allows GForum to authenticate the user.

Jason Rhinelander
Gossamer Threads
Quote Reply
Re: [Jagerman] Current user In reply to
Oh dear Blush - I found that I had mistyped the domain name in the cookie setting in admin.

Hopefully this means that the problem was occuring with IE not accepting third party cookies. I'm hoping that's fixed it anyway.

Thanks, Laura.