bp_friends_random_friends

Output a block of random friends.

Description

bp_friends_random_friends(); 

No longer used in BuddyPress.


Usage

  1. if ( !function_exists( 'bp_friends_random_friends' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-friends/bp-friends-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_friends_random_friends(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-friends/bp-friends-template.php  
  1. function bp_friends_random_friends() { 
  2.  
  3. if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) { 
  4. $friend_ids = BP_Friends_Friendship::get_random_friends( bp_displayed_user_id() ); 
  5. wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp' ); 
  6. } ?> 
  7.  
  8. <div class="info-group"> 
  9. <h4><?php bp_word_or_name( __( "My Friends", buddypress ), __( "%s's Friends", buddypress ) ) ?> (<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ) ?>) <span><a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() ) ?>"><?php _e('See All', buddypress) ?></a></span></h4> 
  10.  
  11. <?php if ( $friend_ids ) { ?> 
  12.  
  13. <ul class="horiz-gallery"> 
  14.  
  15. <?php for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) { ?> 
  16.  
  17. <li> 
  18. <a href="<?php echo bp_core_get_user_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a> 
  19. <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5> 
  20. </li> 
  21.  
  22. <?php } ?> 
  23.  
  24. </ul> 
  25.  
  26. <?php } else { ?> 
  27.  
  28. <div id="message" class="info"> 
  29. <p><?php bp_word_or_name( __( "You haven't added any friend connections yet.", buddypress ), __( "%s hasn't created any friend connections yet.", buddypress ) ) ?></p> 
  30. </div> 
  31.  
  32. <?php } ?> 
  33.  
  34. <div class="clear"></div> 
  35. </div> 
  36.  
  37. <?php