Skip to:
Content
Pages
Categories
Search
Top
Bottom

Include a 'Members of my groups'-view in the index.php of members

  • @marmuel

    Participant

    Hi there,

    actually I use child-theme, based on the bp-default-Theme.

    I have added a new site, where I list all members of the groups, which the user is member of.
    Unfortunately, I don´t know how I could insert this view in the members/index.php of my child-theme. Actually I use link from the index.php to a separate site of wordpress. The Problem is, all items of the navigation are “lost” and a further site is not very user-friendly.
    Every works fine. But is there any chance to include this directly in my index.php of the child-theme?

    The link in theme/buddypress/members/index.php of my child-theme

    <li id="members-my"><a href="/vereinfaches/vereinskollegen/" class="no-ajax-customlink"><?php printf( __('Meine Vereinskollegen') ) ?></a></li>

    The code in the template of my new site:

    <div id="buddypress">
    		
     <?php 
    $user_id = bp_loggedin_user_id();
    $groups = $wpdb->get_col($wpdb->prepare("SELECT group_id FROM {$wpdb->prefix}bp_groups_members WHERE user_id = %d",$user_id),0);	
    global $wpdb;
    $allUsers = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT user_id FROM {$wpdb->prefix}bp_groups_members WHERE group_id IN (".implode(', ', array_fill(0, count($groups), '%s')).")",$groups),0);
      
     if ( bp_has_members( array( 'include' => $allUsers ) ) ) : ?>
     
      <div id="member-count" class="pag-count">
        <?php bp_group_member_pagination_count() ?>
      </div>
     
      <div id="member-pagination" class="pagination-links">
        <?php bp_group_member_pagination() ?>
      </div>
     
      <ul id="member-list" class="item-list">
      <?php while ( bp_group_members() ) : bp_group_the_member(); ?>
     
        <li>
          <div class="item-avatar">
    				<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
    			</div>
    
    			<div class="item">
    				<div class="item-title">
    					<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
    
    					<?php if ( bp_get_member_latest_update() ) : ?>
    
    						<span class="update"> <?php bp_member_latest_update(); ?></span>
    
    					<?php endif; ?>
    
    				</div>
    
    				<div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
        </li>
      <?php endwhile; ?>
      </ul>
      
    <?php endif; ?>
    </div><!-- #buddypress -->
Viewing 3 replies - 1 through 3 (of 3 total)
  • @marmuel

    Participant

    no ideas?

    @shanebp

    Moderator

    In members/index.php, you will see this:
    <?php bp_get_template_part( 'members/members-loop' ); ?>

    Either create your own template and call it there.
    Or adjust the members/members-loop.php file.

    Since you are using a child theme, probably easiest to go with the adjust-file approach.

    Based on what you’re doing, there is no need to change members/index.php

    @marmuel

    Participant

    I´m not shure, if I get you right.

    I understand, that the members-loop creates the content for members-list.
    But how can I integrate this in the members-loop. I need all views, the common view of the members-loop and my view, if the user clicks on the above mentioned link.

    Cheers and Thank you
    Marco

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Include a 'Members of my groups'-view in the index.php of members’ is closed to new replies.
Skip to toolbar