Skip to:
Content
Pages
Categories
Search
Top
Bottom

List of group forums & topics

  • @nicow65

    Participant

    Hi !

    I’m havin some troubles.

    I want to display avatar of each group where the user is a member.
    -> Done

    I want to display, if the group have a forum, a link to the forum
    -> done

    I want to display, if the forum have topics, few newest topics
    -> need to done

    Actually, my code crawl the groups but is locked on the first forum and, for each group, display topics which are on the first forums.

    I’m adding you my code :

    
     while ( bp_groups() ) { bp_the_group(); 
    	
    			echo '<a href="'.bp_get_group_permalink().'" title="'.bp_get_group_name().'">'.bp_get_group_avatar('type=full&width='.$size.'&height='.$size) . '</a>';
    			
    			// si le groupe a un forum je return 1
    			if( bp_group_is_forum_enabled($group) ) {
    					// si dans ce forum il y a des topics je return 1
    					if ( bbp_has_topics()) {
    						bbp_topic_forum_id(); 
    						echo " Forum : " .bp_get_group_name();
    
    <ul>
    		<?php while ( bbp_topics() ) : bbp_the_topic(); ?>
    			<li>
    				<a>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a>
    			</li>
    		<?php endwhile; ?>
    </ul>
    					}
    					else {
    					}
    			}
    			else {
    			}
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • @shanebp

    Moderator

    Did you try explicitly setting the forum id?
    Something like:

    if( bp_group_is_forum_enabled($group) ) {
    	$forum_id = groups_get_groupmeta( bp_get_group_id(), 'forum_id' );
    	echo 'forum id: ' . $forum_id;
    	$bbp_args = array( 'post_parent' => $forum_id ); 
    	if ( bbp_has_topics( $bbp_args ) ) {
            //etc

    @nicow65

    Participant

    Wow nice !Thank shanebp !

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