Gossamer Forum
Quote Reply
if group
I'd like to do something like:

<%if group_id = 3%>
Hiya in group 3
<%endif%>

I would imagine this to be possible via a new global, but have no idea how to make such.

Any ideas?
Quote Reply
Re: [gotze] if group In reply to
Could probably do it with something like this;

Code:
sub {

my $id = '3';

my $table = $DB->table('UserGroup');
my $chk = $table->count( { group_id_fk => $id, user_id_fk => $USER->{user_id} } ) || 0;

if ($chk > 0) {
return 1;
} else {
return 0;
}

# Basically, the query is:
# SELECT COUNT(*) FROM forum_UserGroup user_id_fk => $USER->{user_id} group_id_fk= 5
# This checks to see if the user is a member of the group specified
}

Call with;

<%global_name%>, and it should pick up their user_id if they are logged in :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates