This is something that my users required, so I built the functionality with the following code.
I have a module called MYSITE (not really, but you get the idea) that I do small modifications to for my site. In that module I put the following code:
function MYSITE_get_forum_moderators($tid) {
$moderators = array();
$acl_id = db_result(db_query("SELECT acl_id from {acl} WHERE module = 'forum_access' && name = %d", $tid));
$query = db_query("SELECT u.uid, u.name FROM {users} u INNER JOIN {acl_user} a ON u.uid = a.uid WHERE a.acl_id = %d", $acl_id);
$i = 0;
while($account = db_fetch_object($query)) {
$moderators[$i] = l($account->name, "users/".$account->name);
$i++;
}
return $moderators;
}
Now you have a function that goes and gets all of the moderators for a given $tid and returns an array of links to that users profile.
In the file advf-forum-list.tpl.php now all you have to do is place the moderator information. In the else section of this conditional ( if ($forum->is_container):
) I put the following code below the description section.
<?php if ($moderators = MYSITE_get_forum_moderators($child_id)): ?>
<div class="moderators"><?php print t("Moderators: ").implode(", ",$moderators); ?></div>
<?php endif; ?>
Thats it... Enjoy...
Comments
Comment #1
swill CreditAttribution: swill commentedA slight modification. On my site I do not allow Anonymous users to view profiles, because of this I do not want them to see a link, just the name of the moderator. I have modified the function slightly to do a check if there is a user logged in and then generate the array appropriately...
Cheers...
Comment #2
MichelleI need to dig in this more but, just based on your comment, I would change that to use theme_username which already takes care of the access control unless there's some reason why you didn't do that?
Duping #303541: Add list of forum moderators in favor of this one since it has code. Also, for reference, #109924: List moderators in forums listing in the forum access queue.
Do you have any idea if this code works with the D6 version of forum access?
Michelle
Comment #3
swill CreditAttribution: swill commentedThe reason I did not use theme_username is because i am ignorant. haha... I did not realize that function existed. That is a much better solution obviously, so here is the updated function:
In regards to D6, I do not know... I do not have any forums running in D6 yet. If someone could test that it would be appreciated...
Comment #4
aharown07 CreditAttribution: aharown07 commentedI think I might be interested in using this but I'm not clear on what it does. Does it just list moderators assigned to each forum? What caught my eye was "access moderators" because I'm looking now for a way to make all new "authenticated users" go to a queue and wait for approval by someone before they can post in the forums.
Does this do that?
Edit: just realized moderation of new accounts is built in if you use that setting... just hadn't looked in the right place.
I'd still like to know what what his hack here does though!
Comment #5
MichelleThis is to list the moderators on the forum listing.
Michelle
Comment #6
aharown07 CreditAttribution: aharown07 commentedTks, Michelle.
Comment #7
MichelleThis is going to wait for 2.x
Michelle
Comment #8
MichelleUn postponing because #109924: List moderators in forums listing makes this a trivial add.
Michelle
Comment #9
MichelleActually... That's a D6 only feature on FA's end and I want the 1.0 of both branches to be the same. Re-postponing but it will likely be one of the first things to go into 2.x.
Michelle
Comment #10
MichelleComment #11
MichelleWill be using the new moderation module instead. Will file a new issue when that is ready.
Michelle
Comment #12
Elin Yordanov CreditAttribution: Elin Yordanov commentedHey, thanks for the script. I have adjusted it for Drupal 7 version. If anyone needs it for Drupal 7, here is my code:
I also changed it a little bit, so that it returns not only the user name, but the complete user object, so that I can access all user fields.