Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Global help

Quote Reply
Global help
I'm trying to have a global check if a post author is in a particular group, and then assign them a particular color if they are, but it's behaving oddly. When I do just <%user_groupcheck($user_id)%> it correctly returns what I need it to, either 1 or 0. However, when I use it as I need to, within an if statement, it acts as though it's always false.

<%if user_groupcheck($user_id)%><%grouphtml%><%endif%>

The global I have is:
'user_groupcheck' => 'sub {
my $uid = shift;
my $count = $DB->table("UserGroup")->count({
group_id_fk => 18,
user_id_fk => $uid
return ($count and $count > 0);

Realiiity.com Forums
Quote Reply
Re: [ellipsiiis] Global help In reply to
I don't think you can do that. Try:
<%set groupcheck = user_groupcheck($user_id)%><%if groupcheck%><%grouphtml%><%endif%>

Quote Reply
Re: [brewt] Global help In reply to
Yeah, I'm almost definate you can't do that. Similar problem in LinksSQL. I normally get around it by doing;


<%if tag_name%>foo<%endif%>

sub {

my $val = $_[0]; # get the value passed in...

# do something

return { tag_name => $val };



Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!