Skip to:
Content
Pages
Categories
Search
Top
Bottom

do_action missing when bbp_list_forums() is called


  • Rourke
    Participant

    @rourke

    I’ve changed the loop-single-forum.php template file so that the frontpage contains all the forums on a single page. It look like this.

    I’m also trying to implement a plugin called bbPress Unread Posts v2. It’s placing an icon before every forum title to notify the user when new posts/topics have been made in a forum.

    As you can see in the template I’m firing bbp_list_forums() to list the forums. However this function does not fire the action bbp_theme_before_forum_title which means a plugin won’t affect these lists of forums.

    I can imagine I need a manual way to list all forums so I can fire a do_action. But how would I be able to do that?

Viewing 4 replies - 1 through 4 (of 4 total)

  • Rourke
    Participant

    @rourke

    No one can help me out on this?

    Hi Rourke,
    Not sure I understand your question, but if you want to list all forums, this is a loop I have in one of my plugins:

    	if ( bbp_has_forums() ) {
    		while ( bbp_forums() ) {
    			bbp_the_forum();
    			$forum_id = bbp_get_forum_id();
    			$forums_title = bbp_get_forum_title($forum_id);
    			array_push($all_forums_ids, $forum_id);
    			<...>
    			// Check for subforums (first level only)
    			if ($sublist = bbp_forum_get_subforums($forum_id)) {
    				$all_subforums = array();
    				foreach ( $sublist as $sub_forum ) {
    					<...>
    				}
    			}					
    			$i++;
    		} // while
    	} // if

    Hope it gets you in the right direction,
    Pascal.


    Robkk
    Moderator

    @robkk

    I say since I think you are trying to set up hiarchal forum and category layout, insert this loop-forums.php file into your child theme instead of what you did.

    https://github.com/robkk/bbPress-Hierarchical-Forum-and-Category-Layout/blob/master/loop-forums.php

    If you want to try to add the hook into the bbp_list_forums() function, you have to filter the output put the hook before every list item.

    bbp_list_forums


    Rourke
    Participant

    @rourke

    Thanks guys!


    @robkk
    That’s exactly what I was looking for. It has a nice proper forum layout 🙂
    And my plugins hook on it great!

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