Version: , by Admin (Coder)
Developer Last Online: Nov 2024
Version: 2.0.x
Rating:
Released: 09-16-2001
Last Update: Never
Installs: 22
No support by the author.
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.
// 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
with
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
We don'e with forum.php, save and upload.
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');
with
PHP Code:
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND showonhome=1 AND active=1 ORDER BY parentid,displayorder');
We don'e with index.php, save and upload.
That's it!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Originally posted by TurboFC3S So are there any hacks similar to this that allow you to do sub-forums as well? How about instead of show on forum home, give the option - show on parent page.
Originally posted by TurboFC3S So are there any hacks similar to this that allow you to do sub-forums as well? How about instead of show on forum home, give the option - show on parent page.
Does that make any sense what I'm talking about?
So is anybody going to answer my question ... please?
Originally posted by Psychdrone I am confused this will give you an option to either have the forum displayd on the main page? dose this work on 2.2.1?
01-29-02 at 06:51 PM Gutspiller said this in Post #25 how about making this option available to the end user, and not just for admins? I could really use a hack like THAT.
yes, exactly waht I need. Is there something like that yet?