BuddyDev

Search

Trying to improve the Group home page

  • Participant
    Level: Master
    Posts: 413
    Venutius on #1657

    Ah, the loop-topics loop does not use bbp_has_topic

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #1660

    In that case we can put the following

    
    <?php if ( bbp_has_topics() ) : ?>
    
    //our loop code here..
    
    <?php endif;?>
    
    

    Please don’t forget the changes I mentioned.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #1662

    Yes that works, I have my forum list followed by Activity, Now I need to change the formatting somehow to stop the two lists flowing into each other.

    One thing, some of my groups do not have a forum, will this cause an error in what we have created?

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #1663

    Hi George,
    Thank you for confirming.

    It won’t cause error but will list recent topics which is not a great thing to do.

    The better strategy will be doing like

    
    <?php if( ! empty( $forum_id) && bbp_has_topics( array( 'post_parent' => $forum_id )  ) ) :?>
    
    //show loop
    <?php endif;?>
    
    

    Hope that helps.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #1664

    There must be an error in that code as I’m getting nothing displayed now, not even an error

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #1665

    Are you using my previous code to get the $forum_id before using the above snippet. If not, then that’s why It is happening.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #1666

    I revert back to the previous working code and I’m getting some odd behaviour on wider testing, it seems the topic list is showing all topics for all forums. Previously I only had one group with a forum and a couple of test topics, so the topic list showed correctly. However now that I’ve set up a second group with a forum and test topic I can see that I am seeing all topics for both forums in the forum topic list on the group homepage.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #1667

    Can you please post the code here( only till the bbp_has_topics() ) code block. No need to post the content inside the loop. Most probably you are not passing the forum id.

  • Participant
    Level: Master
    Posts: 413
    Venutius on #1668

    “Are you using my previous code to get the $forum_id before using the above snippet. If not, then that’s why It is happening.”

    I did have it before but I switched it to after and I still get a blank page

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #1669

    Hi George,
    Please post the code. That will allow me to help you better.

You must be logged in to reply to this topic.

This topic is: not resolved