bbPress

Simple, Fast, Elegant

bbPress support forums » Installation

Hiding Subforums' Subforums from Subforum Pages

(16 posts)
  • Started 1 month ago by lunchboxtalk
  • Latest reply from chrishajer
  • This topic is not resolved
  1. lunchboxtalk
    Member

    Hi.

    This is an extension of this question: http://bbpress.org/forums/topic/hiding-subforums-on-the-homepage#post-11761

    My forum has forums, subforums, and then subforums of those subforums. Basically, there are three levels of forums.

    I was able to hide the subforums from the main forums page. But how do i hide the subforums' subforums from the subforums pages, so that the visitor must click on the subforum to view the subforums' subforums.

    I would really appreciate any help on this matter. I am not good at coding so it would be wonderful to get assistance! :)

    Posted 1 month ago #
  2. The way I hide sub-forums on the front-page is to wrap the code that lists the forums in this simple code:

    <?php if (!$forum->forum_parent) { ?> <-- this
    <tr<?php bb_forum_class(); ?>>
    blah blah
    </tr>
    <?php } ?> <-- and this

    It essentially just checks if the forum has a parent and doesn't show it. Now on the forum page that's a problem because any forum listed would have a parent. Gotta think about that one for a minute...

    Oh wait, I know what to do, we just have to check if the forum_parent is equal to the current forum id. This is untested but in theory should work:

    <?php $forum_parent=$forum_id; ?>
    <?php while ( bb_forum() ) : ?>
    <?php if ($GLOBALS['forum']->forum_parent==$forum_parent) { ?>
    <tr<?php bb_forum_class(); ?>>
    	<td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td>
    	<td class="num"><?php forum_topics(); ?></td>
    	<td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php } ?>
    <?php endwhile; ?>
    Posted 1 month ago #
  3. lunchboxtalk
    Member

    Thank you for the response. I have very, very limited coding experience. Can you explain further please? Thank you.

    Posted 1 month ago #
  4. You have to edit the forum.php in your theme's template.

    Are you using the built in Kakumei theme or have you already changed it?

    Posted 1 month ago #
  5. lunchboxtalk
    Member

    I have already changed it.

    Here is my forum.php:
    http://pastebin.com/m3c1eab2b

    I appreciate the help!

    Posted 1 month ago #
  6. Here you go:
    http://pastebin.com/m6e93abf8
    (you can copy the plain text from the lower part)

    The lines added are 49, 51 and 57.
    It's untested but in theory should work.
    Let me know what happens.

    Posted 1 month ago #
  7. lunchboxtalk
    Member

    Hi,

    Okay, so I tried using the code. And it just makes every subforum and its subforums disappear. So everything is there, but with no links to any forums.

    Posted 1 month ago #
  8. Can you post the code you're using at pastebin so we can take a look at what's happening?

    Posted 1 month ago #
  9. lunchboxtalk
    Member

    The code that was on my original forum.php is
    http://pastebin.com/m3c1eab2b

    _ck_'s version that I tried using (it didn't pop up any forums at all when I tried it) is
    http://pastebin.com/m6e93abf8

    Posted 1 month ago #
  10. Hang on while I double check the code, apparently I guessed wrong somewhere or missed something.

    update: perhaps it's because $forum is not declared as a global in the template when when it loops through the forums it doesn't see the changed parent.

    Try this update:
    http://pastebin.com/m3cef6607

    Posted 1 month ago #
  11. lunchboxtalk
    Member

    Hi,

    Now the subforums' subforums show, but along with the subforums. It displays just like the original forum.php now. :(

    Posted 1 month ago #
  12. I just put the code on a test site and it works for me.
    Sub forums show, but not sub sub forums.

    You used http://pastebin.com/m3cef6607 ???

    The sub sub forums you are seeing are indented?
    Make sure you uploaded and are using the correct file.

    Posted 1 month ago #
  13. I uploaded that code to a test installation I have and it appears to work fine. Check it out:

    http://riversideinfo.org/bbpress-0902/

    Posted 1 month ago #
  14. lunchboxtalk
    Member

    Hi! Thank you _ck_ and chrishajer. It works wonderfully now.

    I have a few more questions if you don't mind:

    1. Is there any way to optimize bbPress for extremely large forums? My forum will have 50 forums, followed by subforums for cities, followed by 5 subforums for each city. (I've thought it over through as well, and this is the best way to organize it)
    2. If there isn't, is there a way I can create 50 forums that are different, one for each state, and have them running congruently? Would that alleviate the loading time and the strain on the database?
    3. Is there any way to have many separate forums that are sharing the same users table? They are going to be separate forums. I just want to have it so that 1) if one person is logged into one bbpress, they are also logged into another, and 2) if they are registered on one, they are also registered at another. Is there a way to do this?

    What would be the best way to handle this? It's just that when I release the site, I want to have every section and everything up so that I don't have to worry about expanding. I just want to do everything now (and having a lot of free time during the summer doesn't hurt either!)

    Thanks.

    Posted 1 month ago #
  15. You might want to start a new topic for that new topic, now that you have the subforums thing sorted.

    You situation sounds like this one from a while ago
    http://bbpress.org/forums/topic/how-do-i-do-this

    I am not sure what the best way to do it is. Did you try making the forums and subforums all in one forum installation, and see what the actual loading time is? That would be easiest for user login integration I think.

    Can you imagine updating 50 forum installations?

    Posted 1 month ago #
  16. It's too bad the pastebin code is no longer available. :-(

    Posted 1 day ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.