According to the license of punbb the following idea and code are subject to the GPL.
Add a table named $punbb_prefix.'forum_icon' to your database :
CREATE TABLE `punbb_forum_icon` ( `forum_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0', `icon` VARCHAR( 80 ) NULL , UNIQUE ( `forum_id` ) ) ENGINE = MYISAM;
Create an icons directory in the img directory of punbb, and add icon files of 32px X 32px.
Open index.php and replace (or comment out) this query :
// Print the categories and forums $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
by this one :
/*** /!\ This query as been modified for the icon's hack /!\ ***/ $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, fi.icon FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'forum_icon AS fi ON fi.forum_id=f.id WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
Then add the part in comment at the right place in index.php
<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div> <?php //**************************************** BEGIN forum's icons hack ***************************************// ?> <div class="ficon"> <?php if ($cur_forum['icon']) { ?> <img src="img/icons/<?php echo $cur_forum['icon']; ?>" alt="<?php echo pun_htmlspecialchars($cur_forum['forum_name']); ?>" /> <?php } else echo ' '; ?> </div> <?php //**************************************** END forum's icons hack ***************************************// ?> <div class="tclcon"> <?php echo $forum_field."\n".$moderators ?> </div>
Edit the class name just after the icons hack part :
<div class="tclcon_ih"> <?php echo $forum_field."\n".$moderators ?> </div>
Add this class in your (or every) css file in the style directory of punbb :
/* icon's hack */ DIV.ficon { FLOAT: left; MARGIN-TOP: 0.1em; MARGIN-LEFT: 0.8em; MARGIN-RIGHT : 0.8em; DISPLAY: block; BORDER : 0px; WIDTH : 32px; } TD DIV.tclcon_ih {MARGIN-LEFT: 65px}
Create the entries in the data base with the forum id and the name of the icon image… Or write a plugin to choose the images within the administration panel
Try your new forum…