Version: 0.1, by tehcake
Developer Last Online: Jul 2005
Version: 3.0.7
Rating:
Released: 05-18-2005
Last Update: Never
Installs: 3
DB Changes
Code Changes Additional Files Is in Beta Stage
No support by the author.
This has been done before, but I've yet to see it released here. I was desperate to have this for my forums which has a lot of posticons.
This hack allows you to make posticons useable in only forums you specify. I'm no PHP expert, and I find it amazing how I pulled this off (Had a little help from someone to get it working correctly.), so you won't be able to set the settings through admincp yet. Instead, you have to manually do some changse in your MySQL database for each posticon.
Step 1 MySQL
First, you'll have to go to the icon table in your MySQL database. Create a field called iconforums in the table. Then edit each posticon (phpMyAdmin you'll have to click on the BROWSE tab in the table to edit the fields.), add the forumids to the iconforums field, seperating each forumid with only a comma.
Step 2
Now you'll have to edit your includes/functions_newpost.php.
FIND
Code:
SELECT iconid, iconpath, title
REPLACE WITH
Code:
SELECT iconid, iconpath, title, iconforums
FIND
Code:
while ($icon = $DB_site->fetch_array($icons))
{
ADD BELOW
Code:
$forumid = $foruminfo[forumid];
$forums = explode(',',$icon[iconforums]);
if (in_array($forumid,$forums))
{
you know when u create a thread or post?
u have the icons u can use for that thread or post
this makes it so some icons will only show up in certain forums and hence can only be used in those forums
i have the perfect use for this, a coding forum where there are icons based on what code your thread is about
i find people using those icons in off topic :/
ps, heres the code
as u can see its exactly as ur instructions say...
PHP Code:
// original SELECT iconid, iconpath, title
$icons = $DB_site->query("
SELECT iconid, iconpath, title, iconforums
FROM " . TABLE_PREFIX . "icon AS icon
WHERE imagecategoryid NOT IN (0$badcategories)
ORDER BY imagecategoryid, displayorder
");
if (!$DB_site->num_rows($icons))
{
return false;
}
$numicons = 0;
$show['posticons'] = false;
while ($icon = $DB_site->fetch_array($icons))
{
// hack
$forumid = $foruminfo[forumid];
$forums = explode(',',$icon[iconforums]);
if (in_array($forumid,$forums))
{
// hack end
$show['posticons'] = true;
if ($numicons % 7 == 0 AND $numicons != 0)
{
$posticonbits .= "</tr><tr><td> </td>";
}
Sorry Jenta, but I'm not really a PHP/MySQL person, so I went into phpMyAdmin and did it all by hand instead of using a query. I don't know if it's the problem, but maybe it's the CREATE part because the icon table already exists?
Sorry Jenta, but I'm not really a PHP/MySQL person, so I went into phpMyAdmin and did it all by hand instead of using a query. I don't know if it's the problem, but maybe it's the CREATE part because the icon table already exists?
the create code is just my dump of the table, i didnt use it to actually add ur row
its only to show the rows and what is in each
PHP Code:
`iconforums` varchar(100) NOT NULL default '',
this is the row you say to create
can you look at yours and see if its the same?
for those wanting an image, heres one straight from this forum
these are post icons
this hack lets u set which forum each post icon will appear in
its the same as setting an icon category that only certain usergroups can use but its forum bases instead of usergroup based
here's a scenario that might help some understand
lets say you run a decorating forum with different forums
one forum is for gardens and stuff
you have post icons like - rakes and wheelbarrows
then you have another forum about kitchens
you have icons like - cups and refrigerators
then u have a forum where people talk about everyday life - off topic
u dont want the cups, refrigirators, rakes or wheelbarrrow appearing there