1 (edited by Cactuz 2003-07-28 20:10)

Topic: Category when make user moderator i Forums

When you adding a user to the moderator list for a forum there should be something that shows which category the forum is in. If you have many forums called General in different categories you have no clue which one you should add.

Maybe if you put it out like this:
Category/Forum

or

Category
- Forum
- Forum
- Forum
Category
- Forum
- Forum
- Forum

Heres code which make the second solution (profile.php line: 1143):

            $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.moderators FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id'.$extra.' ORDER BY c.position, cid, f.position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

            while ($cur_forum = $db->fetch_assoc($result))
            {
                if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?
                {
                    echo $cur_forum['cat_name'].'<br>';
                    $cur_category = $cur_forum['cid'];
                }
                
                $moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();

                print "\t\t\t\t".'- <input type="checkbox" name="moderator_in['.$cur_forum['fid'].']" value="1"'.((in_array($id, $moderators)) ? ' checked' : '').'> '.htmlspecialchars($cur_forum['forum_name']).'<br>'."\n";
            }

Re: Category when make user moderator i Forums

A good suggestion. I'll use the code you posted.

Edit: One small change though. It should be

name="moderator_in['.$cur_forum['fid'].']"

and not

name="moderator_in['.$cur_forum['id'].']"

:-)

"Programming is like sex: one mistake and you have to support it for the rest of your life."