PDA

View Full Version : forum moderators


Sebastian
05-14-2003, 06:59 AM
anyone care to help me out..

I'd like to display all the forums title of the forums a user moderates on postbit.

say i am the mod of forum "Hack Requests"

below my name something like "Mod of: Hack Requests" would appear.

thing is, i don't want forum names to appear if a user doesn't have access to that particular forum..

i tried using showgroups.php as a base, but i am really lost.

see here:
https://vborg.vbsupport.ru/showgroups.php

under "Moderated Forums" is what i want to put in postbit.

thanks for any help.

Sebastian
05-14-2003, 07:09 AM
see if this screenshot makes sense.

Boofo
05-14-2003, 07:23 AM
Here is the piece of code I think you need to play with:

$listexploded=explode(",", $forum['parentlist']);
while ( list($mkey1,$mval1)=each($listexploded) ) {
if ( !isset($imodcache["$mval1"]) ) {
continue;
}
reset($imodcache["$mval1"]);
while ( list($mkey2,$moderator)=each($imodcache["$mval1"]) ) {
if ( !isset($forum['moderators']) ) {
eval("\$forum['moderators'] = \"".gettemplate('forumhome_moderator')."\";");
} else {
eval("\$forum['moderators'] .= \", ".gettemplate('forumhome_moderator')."\";");
}
}
}

Sebastian
05-14-2003, 09:53 AM
that won't work.. see the screenshot in my second post.
trying to get the list of forum titles that a user is moderator of and display the list on postbit.

Boofo
05-14-2003, 10:02 AM
The this is the query you want.

$users = $DB_site->query("
SELECT
$locationfieldselect forum.forumid, forum.title AS forumtitle,
user.username, user.userid, user.invisible, user.showemail, user.receivepm, user.lastactivity, user.lastvisit
FROM moderator
LEFT JOIN user ON (user.userid = moderator.userid)
LEFT JOIN forum ON (forum.forumid = moderator.forumid)
LEFT JOIN userfield ON (userfield.userid = user.userid)
WHERE forum.active = 1
ORDER BY user.username ASC, forum.displayorder ASC
");

Xenon
05-14-2003, 11:40 AM
i can just say:
DONT DO IT.

As you want it in postbit it would produce extraqueries for every moderatorpost.
second to include also the permissions it would also slow down the page and wouldn't make it easier to write the forumlist at all.

sur you can come up with some sort of caching, but it will always slow down the pgae gen