====== Punbb icons hack ======
===== License =====
According to the license of punbb the following idea and code are subject to the GPL.
===== How to use this hack =====
==== Create a table ====
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 a directory for the icons ====
Create an icons directory in the img directory of punbb, and add icon files of 32px X 32px.
==== Edit index.php ====
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
Edit the class name just after the icons hack part :
==== Edit the css file ====
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}
==== Fill the data base ====
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**
==== That's all ====
Try your new forum...