Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Forums


  • eVersatile
    Participant

    @eversatile

    Can anyone tell me where to find the file in bbpress/buddypress that displays group forums topics loop.
    When I make a change to loop-forums-single.php for the main forum it also changes the template for the group forums. I can not locate the section that gets the template. After I find the action I will create a new php file for the groups so the templates are seperated

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

  • tharsheblows
    Participant

    @tharsheblows

    So what you want is if a forum is in a group, it gets one template and if it’s not in a group, it gets another? eg in loop-forums.php you want something like:

    <?php while ( bbp_forums() ) : bbp_the_forum(); ?>
    
      if( this is a group forum ){
       <?php bbp_get_template_part( 'loop', 'single-group-forum' ); ?>
      }
      else{
        <?php bbp_get_template_part( 'loop', 'single-forum' ); ?>
      }
    
    <?php endwhile; ?>

    where bpp_get_template_part( ‘loop’, ‘single-group-forum’ ); gets a template part named “loop-single-group-forum.php” that you’ve created, probably by copying and modifying “loop-single-forum.php”.

    I’d think that’d be possible but while I’m looking for whatever goes in that if statement, want to check that that’s what you mean! No worries if not, one of my core competencies is misreading and misunderstanding posts. 😉


    tharsheblows
    Participant

    @tharsheblows

    Ok — again, I think this is what you mean. It might not be! I’ve left in some bits that will show you exactly what’s happening.

    <?php while ( bbp_forums() ) : $forum = bbp_the_forum();
       // if it's a group forum, then this is true
       if(  bbp_is_forum_group_forum( bbp_get_forum_id() )){
          echo '<strong>The following *is* a group forum:</strong>';
          // this is the bit you would change to your new template. And take out those echos, they're just something I find useful and thought you might too! :)
          bbp_get_template_part( 'loop', 'single-forum' );
       }
       // if it's not a group forum, do this
        else{
          echo '<strong>The following *is not* a group forum:</strong>';
          bbp_get_template_part( 'loop', 'single-forum' ); 
       }
    ?>

    Slightly off topic, I think that winky icon in my previous post looks a bit creepy. It might be just me though.


    eVersatile
    Participant

    @eversatile

    I apologize I should have been a little more specific.
    It is actually the actual content of the single forum that I would like to be different.
    This little piece of code <?php bbp_get_template_part( 'form', 'topic' ); ?> is what adds the topic form to the forum. For the main forum I would like to remove that and for the group forums, the topic form should still show.
    The form to add a topic to the main forums would be on a separate page.

    You’re funny.


    tharsheblows
    Participant

    @tharsheblows

    Ah ha! I see what you mean (maybe). So something in content-single-forum.php like this?

    <?php 
       if(  bbp_is_forum_group_forum( bbp_get_forum_id() )){
          bbp_get_template_part( 'form',       'topic'     );
       }else{
          echo '<a href="/">You could link to your form or whatever else here.</a>';  
       } 
    ?>

    rather than what’s there now:
    <?php bbp_get_template_part( 'form', 'topic' ); ?>

    Then you could use the shortcode [bbp-topic-form] on a new page and link to that page.


    eVersatile
    Participant

    @eversatile

    This seems like it could work. I will try to insert it tomorrow. Have a long night ahead of me. Thank you for the input and I will let you know how it went.


    eVersatile
    Participant

    @eversatile

    That did not work. I’m thinking it may not be possible since buddypress group forums integrate with bbpress forums globally


    tharsheblows
    Participant

    @tharsheblows

    Oh no! If you want to check if an individual forum is associated with a group, use the function above: bbp_is_forum_group_forum( bbp_get_forum_id() ) where bbp_get_forum_id() is the forum id (you might have to get it in a different way depending on what you’re doing!).

    Good luck!

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