Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forums index in the same layout as other bb software


  • Kaliceos
    Participant

    @kaliceos

    Hi,

    I’m in the process of migrating a phpBB forum to WordPress with bbPress. I don’t know if the bbPress style is better but my users are used to the phpBB style for displaying Forums on the main page. So I tried to reproduce that layout in bbPress using categories. With the default theme, I was not happy with the way it looked. After a quick search in these forums, I saw some interesting topics from @lynq (here and there) but it didn’t work as intended in the last bbpress release and ticket #1958 has been moved to 2.6.

    So after a few hours of searching codex, and a lot of tries, I managed to do what I wanted. As there is still some demand in Lynq’s topic, I thought I should share my little work.

    I’m not a developper, so my code may be a little messy, but it works as intended. I’ve tried using the bbpress functions, and commented my code. If any PHP expert would like to review it and make it better, any feedback is welcome.

    The only file to change is loop-forums.php with this code.
    You just need to create it and paste the code. Then upload it to /wp-content/your-theme/bbpress/. Use a child-theme if you don’t want to loose it on next theme update.

    The forums are not yet online, so here are some screenshots with descriptions. (In French, because, as you may have noticed, English is not my native language 🙂 )

    I’ve tested many situations (even a category inside a forum, which bbpress doesn’t consider anymore as a category, probably normal behavior) and I think everything works as intended. Feel free to report any bug.

Viewing 25 replies - 1 through 25 (of 42 total)
  • Nice, will take a closer look when I get the chance 🙂


    inspirationally
    Participant

    @inspirationally

    This was exactly, what I needed –
    but unfortunately it does not completely work for me.
    I have 4 categories with subforum (some even sub-subforums) each.

    The code displays now 4 times the WHOLE forum the usual way, just with the 4 different categories as headlines. Any idea? See here: http://deppheads.johnny-depp.org/forums/all-forums/

    Do you have any idea? I copied your code 1:1. Somehow it doesn’t seem to catch the “new” parent forum for the subforums display. I guess.


    Kaliceos
    Participant

    @kaliceos

    Indeed, it looks like the new parent is not caught. It’s strange because in the code, the ID of the parent forum is correctly read as we can see in the <ul id="forums-list-17150" class="bbp-forums"> and is seen as a category. It seems like the post_parent argument is not used.

    Have you (or your theme creator) applied a filter to bbp_has_forums ?

    Can you check with an other theme ? (use https://wordpress.org/plugins/theme-test-drive/ if you don’t want to disturb your visitors)


    inspirationally
    Participant

    @inspirationally

    Aaaah there we have it. I use Tehnik BBPress Permissions, too!
    Now I have to see how to combine both. With deactivating your code works perfectly!

    Thanks so much!!


    Kaliceos
    Participant

    @kaliceos

    I checked the code of this plugin and it uses a filter on bbp_has_forums that tries to catch the $args from the original query but they are not transmitted through the filter in bbPress, so it uses the default ones and doesn’t take care of the post_parent argument. You should try to contact the author of the plugin, maybe he can alter the query without parsing all args again. The Codex says it is possible with $query->set().


    lieuline
    Participant

    @lieuline

    A HUGE thank you! 😀 Works great!!!


    niuserre
    Participant

    @niuserre

    I <3 you. This did exactly what I needed, thank you.


    Xevo
    Participant

    @xevo

    Awesome share, really believe this function should be imported to the core soon. Seeing how many people are asking for it.


    Bolder Elements
    Participant

    @hystericallyme

    I’ve spent many, many hours trying to modify my template to achieve something like this. I was about to throw in the towel when I came across this post. I like bbPress, but I find the format of other forums to be more familiar to my customers so it’s better not to make things more difficult 🙂

    Thanks a million!


    prabhatmittal20
    Participant

    @prabhatmittal20

    Just did this on my forum.

    Worked like a charm.

    Thanks


    matrixino
    Participant

    @matrixino

    I was using this and everything worked fine… until I had the need of a “per forum permission” system. Then I tried this plugin https://github.com/ZanderAdam/Tehnik-bbPress-Permissions (the only one I found actually). Now I just get the default listing repeated for each “section” instead of the subforums.
    Seems like I have no other way to restrict single forums to different roles/groups other than this+Members plugin. I wonder why bbPress don’t have a better permission system…
    Can you please look this plugin code and help me fix it?
    Thanks


    inspirationally
    Participant

    @inspirationally

    Kaliceos posted already above an answer to my – the same – problem:

    Forums index in the same layout as other bb software


    but I did write Adam yet regarding that problem.

    I simply commented out

    #add_filter('bbp_has_forums', 'tehnik_bpp_filter_forums_by_permissions', 10, 2);
    

    in tehnik_bbp_forum.php –
    that way the forums still show up, but they cannot be entered without permissions.
    If they are not visible would be better, of course.

    I also commented out

    #if (current_user_can('read_hidden_forums'))
            #$post_stati[] = bbp_get_hidden_status_id();
    

    btw, because I did not want the moderators to enter the hidden forums. Just because they can move threads doesn’t mean they should take a look at the crew forum for the main site.


    Kaliceos
    Participant

    @kaliceos

    Thanks @inspirationnally for sharing your solution. Hope it will get fixed in a future release of the plugin, or in a future release of bbpress.


    matrixino
    Participant

    @matrixino

    Thanks @inspirationnally I did the same thing for now. But as you said I actually wanted to not show them at all. I tried playing with the tehnik_bpp_filter_forums_by_permissions func without luck. Do you think this could be easily fixed plugin-side?

    Also be warned they can still enter the post url and see them (it’s fixed only in their GIT repo) and also they come out in searches (not fixed yet, but a quickfix is available in their bugtrack as a comment).

    Anyway i didn’t notice the Kalice reply above, I’ll try something later and post a fix if working.

    Hi all,

    I am the author of the permissions plugin. Sorry for coming into the discussion this late in, but got the topic link from matrixino. I have not done much with bbPress (or WordPress) in a very long time (.NET shop), so please excuse while I refresh my memory.

    I will look into this as soon as I can.

    FYI https://bbpress.trac.wordpress.org/ticket/1958 Is where we are tracking and getting feedback on implementation, ideas, feedback and so forth for this feature in bbPress Core.


    matrixino
    Participant

    @matrixino

    Seems like this feature is being delayed… delayed… delayed every version in your TRAC.
    Personally I think this “view” should be the default one to adhere with what people expect when coming from any kind of other forum softwares (which also makes more sense to me regarding the visual organization of a forum).

    Also the “per forum permission group” thing is a must in the core of any forum IMHO. There is no way to manage big forums like mine without it, where we have mod groups coordinating different sections/aspects of the site.

    But again this is just my personal opinion.


    Carp Talk
    Participant

    @gloopy

    @kaliceos you sir are a legend 🙂


    wiste
    Participant

    @wiste

    Thanks! Worked like a charm and looks fantastic. Exactly what I needed. You have saved me much hair pulling and banging of head on desk.


    B
    Participant

    @piksel

    @kaliceos thanks for sharing this. Have you ever gotten an undefined variable notice for bbp_forums_noheader?

    if (bbp_is_forum_category() OR !$bbp_forums_noheader) { ?>

    Curious if anyone’s gotten this error when doing a straight copy + paste into loop-forums.php


    B
    Participant

    @piksel

    ah, sorry, spoke too soon. fyi, if you’re seeing this error then you haven’t yet changed the forum attribute type from “forum” to “category” yet. once I did this, it works as expected.

    although if you have nested forum categories (where you have subcategories, but still want the ability to post within that parent category), you still receive that error. i guess a solution would be to restructure how your forum is set up.


    Tecca
    Participant

    @tecca

    Great stuff, @kaliceos! Thanks for posting this, it definitely saves me time having to fiddle around with it myself.


    Bob1nz
    Participant

    @bob1nz

    @kaliceos You are a legend!! thank you so much for sharing this. Finally my bbpress resembles a somewhat “normal” layout


    andresjg
    Participant

    @andresjg

    You are the boss!!!
    THANKS!!!!!!!


    shpitzyl
    Participant

    @shpitzyl

    I’m struggling with this one for a couple of days. Your code solved my problem, Thanks.

Viewing 25 replies - 1 through 25 (of 42 total)
  • You must be logged in to reply to this topic.
Skip to toolbar