Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Returning friend connections of the current profile being viewed

  • @aburi

    Participant

    [WP 3.5.2 / BP 1.8-beta1 / custom theme]

    I am using the code below to display friend connections the member whose profile is being viewed:

    <?php 
    
    global $bp;
    
    $args = array(
      'user_id'	=> $bp->displayed_user->id,
      'max'		=> '30',
      'type'		=> 'random'
    );
    
    if ( bp_has_members( $args ) ) : ?>
    
    <ul id="members-list" class="item-list inline unstyled" role="complementary">
    <?php while ( bp_members() ) : bp_the_member(); ?>
    
    <li><a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a></li>
    
    <?php endwhile; ?>
    </ul>
    
    <?php endif; ?>

    Once I added this, I think the global $bp; slowed down my page load by quite a bit. Since we are already on a member profile page, is there any way to grab the current displayed user’s ID instead of running the global $bp?

    Thanks,
    Alex

Viewing 1 replies (of 1 total)
  • @aburi

    Participant

    Update:

    'user_id' => bp_displayed_user_id(),

    This works so far, and doesn’t use the global $bp;

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Returning friend connections of the current profile being viewed’ is closed to new replies.
Skip to toolbar