This hack adds a yes/no option for forums, to select whether you want to display that forum (or category) on the main page.
I added a "sanity check", so you can't hide forums that have no parent (because then you won't be able to access any of its sub-forums).
I'll get a demo in a few minutes.
Demo::
Installation::
Run this query:
In forum.php (admin folder) replace
with
Still in forum.php, replace
with
Still in forum.php, replace
with
Still in forum.php, replace
with
Still in forum.php, replace
with
Still in forum.php, replace
with
We don'e with forum.php, save and upload.
In index.php (main folder) replace
with
We don'e with index.php, save and upload.
That's it!
I added a "sanity check", so you can't hide forums that have no parent (because then you won't be able to access any of its sub-forums).
I'll get a demo in a few minutes.
Demo::
Installation::
Run this query:
Code:
ALTER TABLE forum ADD showonhome SMALLINT(6) DEFAULT '1' not null AFTER allowicons
PHP Code:
makeyesnocode("Count posts made in this forum towards user post counts?","countposts",1);
PHP Code:
makeyesnocode("Count posts made in this forum towards user post counts?","countposts",1);
maketableheader("Other Options");
makeyesnocode("Display this forum on main page","showonhome",1);
PHP Code:
makeyesnocode("Count posts made in this forum towards user post counts?","countposts",$forum[countposts]);
PHP Code:
makeyesnocode("Count posts made in this forum towards user post counts?","countposts",$forum[countposts]);
maketableheader("Other Options");
makeyesnocode("Display this forum on main page","showonhome",$forum[showonhome]);
PHP Code:
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
PHP Code:
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,showonhome,
PHP Code:
'$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons',
PHP Code:
'$moderatenew','$aallowhtmlcode','$aallowbbcode','$aallowimgcode','$aallowsmilies','$aallowicons','$showonhome',
PHP Code:
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons',
PHP Code:
allowimages='$aallowimgcode', allowsmilies='$aallowsmilies', allowicons='$aallowicons', showonhome='$showonhome',
PHP Code:
// SANITY CHECK (prevent invalid nesting)
if ($parentid==$forumid) {
echo "<b>ERROR:</b> You can't parent a forum to itself!<br><br>".makelinkcode("Go back","javascript:history.back(1)");
exit;
}
$foruminfo = $DB_site->query_first("SELECT forumid,title,parentlist FROM forum WHERE forumid='$parentid'");
$parents = explode(",", $foruminfo[parentlist]);
while (list(,$val) = each($parents)) {
if ($val==$forumid) {
echo "<b>ERROR:</b> You can't parent a forum to one of its own children!<br><br>".makelinkcode("Go back","javascript:history.back(1)");
exit;
}
}
// end Sanity check
PHP Code:
// SANITY CHECK (prevent invalid nesting)
if ($parentid==$forumid) {
echo "<b>ERROR:</b> You can't parent a forum to itself!<br><br>".makelinkcode("Go back","javascript:history.back(1)");
exit;
}
$foruminfo = $DB_site->query_first("SELECT forumid,title,parentlist FROM forum WHERE forumid='$parentid'");
$parents = explode(",", $foruminfo[parentlist]);
while (list(,$val) = each($parents)) {
if ($val==$forumid) {
echo "<b>ERROR:</b> You can't parent a forum to one of its own children!<br><br>".makelinkcode("Go back","javascript:history.back(1)");
exit;
}
}
if ($parentid==-1 and $showonhome==0) {
echo "<b>ERROR:</b> You can't hide a forum with no parent!<br><br>".makelinkcode("Go back","javascript:history.back(1)");
exit;
}
// end Sanity check
In index.php (main folder) replace
PHP Code:
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
PHP Code:
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND showonhome=1 AND active=1 ORDER BY parentid,displayorder');
That's it!
Comment