Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Current User Status

Quote Reply
Current User Status
I was just trying to set up a new template set for moderators only, so as to give me initial feedback about the new template set, without other users having access to the drop list in order to change the template set.

It works for administrators since I can use :
<% if current_user_status = 3%>

but it seems there is no status for moderators in the tables, just registered or validated users or guests.

Anybody know a way around this ?

John
Significant Media
Quote Reply
Re: [Jag] Current User Status In reply to
Jason may be able to answer a bit better, but I don't think there is an easy way to do this. There isn't a flag to say a user is a moderator in any forum. You could just post the link in a moderators only forum?

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Current User Status In reply to
Yes I understand, and pardon my French, but it's a bit of a messy solution also beacuse I was wanting to give certain functions to moderators that I have added and wouldn't be available to registred users.

Would it really mess things up to add an extra value for moderators in the user status like status=4 for moderators.

John
Significant Media
Quote Reply
Re: [Jag] Current User Status In reply to
There will be an easy way to determine a user's groupings in GForum 2.x. Unfortunately, in GForum 1.x there is not simple way.

For your case, I think I'd use a global variable, called, perhaps, current_user_moderator. The content would be:

Code:
sub {
my $tags = GT::Template->tags;
my $user_id = $tags->{current_user_id} or return undef;
my $count = $DB->table("UserGroup")->count({
user_id_fk => $user_id,
group_id_fk => 4
})
return ($count and $count > 0);
}


(You might need to change the 4 to something else - check the group ID for the moderator group. 4, however, is usually the default).

Then, from within a template, simply put something like:

<%if current_user_moderator%>....<%endif%>

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com