Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [sangiro] Advice on adding functionality

Quote Reply
Re: [sangiro] Advice on adding functionality In reply to
In Reply To:
Jason,

Quote:
You can get a list of moderators by calling:

<%GForum::Forum::moderators($forum_id)%>

Is there a easy way to get a list of users who have access to a forum? If for example I've set up a forum that can only be accessed by users in a specific group (or 2 groups), how can I display a list of everyone in those group(s)?

You'd need a global for that - try this:

Code:
sub {
my $forum_id = shift or return;
my $rel = $DB->table(qw/User UserGroup Grouping ForumGroup/);
$rel->select_options("GROUP BY user_username");
my $sth = $rel->select({ forum_id_fk => $forum_id });
my $users = $sth->fetchall_hashref;
require GForum::User;
GForum::User::normalize($users);
return { allowed_users => $users }
}
After calling it as <%global_name($forum_id)%>, you'll have an 'allowed_users' template loop - something like this could be used to list all users:

Code:
<%loop allowed_users%>
<a href="gforum.cgi?username=<%escape user_username%>;<%hidden_query%>"><%user_username%></a><%unless last%>,<%endunless%>
<%endloop%>

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Subject Author Views Date
Thread Advice on adding functionality Ishmael 5672 Mar 11, 2004, 12:39 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 5536 Mar 17, 2004, 7:17 AM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 5532 Mar 17, 2004, 11:03 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 5513 Mar 17, 2004, 12:10 PM
Thread Re: [Ishmael] Advice on adding functionality
Jagerman 5530 Mar 17, 2004, 2:32 PM
Thread Re: [Jagerman] Advice on adding functionality
hoefti 5484 Mar 23, 2004, 9:38 AM
Thread Re: [hoefti] Advice on adding functionality
Jagerman 5454 Mar 25, 2004, 10:17 AM
Thread Re: [Jagerman] Advice on adding functionality
Ishmael 5448 Mar 25, 2004, 3:52 PM
Thread Re: [Ishmael] Advice on adding functionality
Ishmael 5422 Mar 26, 2004, 4:27 PM
Post Re: [Ishmael] Advice on adding functionality
Ishmael 5394 Mar 29, 2004, 6:08 AM
Post Re: [Ishmael] Advice on adding functionality
Jagerman 5389 Mar 30, 2004, 9:07 AM
Thread Re: [Ishmael] Advice on adding functionality
davidnavigator 5087 May 2, 2004, 4:21 AM
Post Re: [davidnavigator] Advice on adding functionality
davidnavigator 4980 Jun 2, 2004, 12:49 AM
Thread Re: [Jagerman] Advice on adding functionality
sangiro 5368 Mar 30, 2004, 2:57 AM
Thread Re: [sangiro] Advice on adding functionality
Jagerman 5374 Mar 30, 2004, 9:24 AM
Post Re: [Jagerman] Advice on adding functionality
hoefti 5072 May 1, 2004, 7:32 PM