PDA

View Full Version : [Release v2.0.3] Use Alternative Forum Icon


Aq.
Wed 24th Oct '01, 8:57am
I have no idea if this hack is already submitted, but here how i hacked a alternative forum icon in place for the on/off.gif icon.

How does it like ?

The Forum:
http://tonny.gamepoint.net/images/icon_forum.gif

The Admin:
http://tonny.gamepoint.net/images/icon_admin.gif


files to edit : index.php, forumdisplay.php, admin/forum.php

Edit index.php and forumdisplay.php
Old: look for this code

// do light bulb
if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']='on';
} else {
if ($bbuserinfo['lastvisit']<$forum['lastpost']) {
$forum['onoff']='on';
} else {
$forum['onoff']='off';
}
}


New: replace with this code

if ($forum['icon']==1) {
$forumicon = $forum['iconname']."_";
if ($forumicon == "_") $forumicon = "";
} else {
$forumicon = "";
}

// do light bulb
if ($bbuserinfo['lastvisitdate']=='Never') {
$forum['onoff']=$forumicon.'on';
} else {
if ($bbuserinfo['lastvisit']<$forum['lastpost']) {
$forum['onoff']=$forumicon.'on';
} else {
$forum['onoff']=$forumicon.'off';
}
}


File: admin/forum.php (i placed those options in style part)
Old: Search this code.

maketableheader("Style Options");

makechoosercode("Custom style set for this forum","styleset","style",1);
makeyesnocode("Override users custom styles<BR>(will force this forums specified colors)","styleoverride",0);


New: replace with this code

maketableheader("Style Options");

makechoosercode("Custom style set for this forum","styleset","style",1);
makeyesnocode("Override users custom styles<BR>(will force this forums specified colors)","styleoverride",0);
makeyesnocode("Enable forum icon","auseicon",0);
makeinputcode("Name of the icon (only shows on enable forum icon 'yes')","iconname");


Old: Search this code.

maketableheader("Style Options");

makechoosercode("Custom style set for this forum","styleset","style",$forum[styleid]);
makeyesnocode("Override users custom styles<BR>(will force this forum's specified colors)","styleoverride",$forum[styleoverride]);


New: Replace with this code.

maketableheader("Style Options");

makechoosercode("Custom style set for this forum","styleset","style",$forum[styleid]);
makeyesnocode("Override users custom styles<BR>(will force this forum's specified colors)","styleoverride",$forum[styleoverride]);
makeyesnocode("Enable forum icon","auseicon",$forum[icon]);
makeinputcode("Name of the icon (only shows on enable forum icon 'yes')","iconname",$forum[iconname]);


WARNING: this code may not be the same as yours, so check only what changes and add it to your code.

Old: This line can be different from your code
Search this code.

$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayo rder,parentid,
parentlist,allowposting,cancontainthreads,daysprun e,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allo wsmilies,allowicons,
styleoverride,allowratings,countposts,moderateatta ch,icon,iconname)
VALUES
(NULL,'$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
'','$allowposting','$cancontainthreads','$daysprun e','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
'$moderatenew','$aallowhtmlcode','$aallowbbcode',' $aallowimgcode','$aallowsmilies','$aallowicons',
'$styleoverride','$allowratings','$countposts','$m oderateattach')");


New:

$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayo rder,parentid,
parentlist,allowposting,cancontainthreads,daysprun e,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allo wsmilies,allowicons,
styleoverride,allowratings,countposts,moderateatta ch,icon,iconname)
VALUES
(NULL,'$styleset','".addslashes($title)."','".addslashes($description)."','$isactive','$displayorder','$parentid',
'','$allowposting','$cancontainthreads','$daysprun e','".addslashes($newpostemail)."','".addslashes($newthreademail)."',
'$moderatenew','$aallowhtmlcode','$aallowbbcode',' $aallowimgcode','$aallowsmilies','$aallowicons',
'$styleoverride','$allowratings','$countposts','$m oderateattach','$auseicon','$iconname')");


Old:

$DB_site->query("UPDATE forum
SET
styleid='$styleset', title='".addslashes($title)."', description='".addslashes($description)."', active='$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist, allowposting='$allowposting', cancontainthreads='$cancontainthreads', daysprune='$daysprune',
newpostemail='".addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
moderatenew='$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons', styleoverride='$styleoverride', allowratings='$allowratings', countposts='$countposts',
moderateattach='$moderateattach' WHERE forumid='$forumid'");


New:

$DB_site->query("UPDATE forum
SET
styleid='$styleset', title='".addslashes($title)."', description='".addslashes($description)."', active='$isactive', displayorder='$displayorder', parentid='$parentid', parentlist=$parentlist, allowposting='$allowposting', cancontainthreads='$cancontainthreads', daysprune='$daysprune',
newpostemail='".addslashes($newpostemail)."', newthreademail='".addslashes($newthreademail)."',
moderatenew='$moderatenew', allowhtml='$aallowhtmlcode', allowbbcode='$aallowbbcode',
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons', styleoverride='$styleoverride', allowratings='$allowratings', countposts='$countposts',
moderateattach='$moderateattach', icon='$auseicon', iconname='$iconname'
WHERE forumid='$forumid'");


Mysqltable:

Mysql> ALTER table forum add icon smallint not null default"0", add iconname char(50) not null;

ftp/copy {name}_on.gif / {name}_off.gif in the forum images dir

Goto admin page, edit your forums, look for Style Option, enable forum icon, and give the icon a name.

Whas that it ?

If you did everithing correctly then you won't get any errors. (I tested and rechecked everithing, but i might have forgotten something to post)

Yes! you are now ready to use the alternative forum icon.

I hope this was enough.

Have fun with it! :cool:

Be sure to make backups from you php files and forum table

snyx
Wed 24th Oct '01, 1:01pm
wicked hack man, but do the "funny fourm icons" have on or off capablitys or are they just one type?

Chen
Wed 24th Oct '01, 1:09pm
Originally posted by Aq.
ftp/copy {name}_on.gif / {name}_off.gif in the forum images
By that and by the code, it supports on/off.

neogeniseva
Wed 24th Oct '01, 1:22pm
wow never thought to have a hack that does this. bad @$$ :D

Bane
Wed 24th Oct '01, 2:48pm
Nice hack Aq :)

Aq.
Wed 24th Oct '01, 3:03pm
hehe, thanks,
never saw such a hack come up in the new version, neither in the older version, (maeby i didn't see) so i posted it
and i knew some ppl would appriciate this hack :)

Could have done more fancy stuff but i was little lazy! :P

And guys from vbb, keep up with the good work! there are some lazy stuff but hehe ;)

snyx
Wed 24th Oct '01, 3:58pm
LOL! Thanks FireFly, wow, shows how much I don't pay attention in the morning! :p