function bp_friends_random_friends() { global $bp; if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . $bp->displayed_user->id, 'bp' ) ) { $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id ); wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' ); } ?> <div class="info-group"> <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 $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> →</a></span></h4> <?php if ( $friend_ids ) { ?> <ul class="horiz-gallery"> <?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?> <li> <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> <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5> </li> <?php } ?> </ul> <?php } else { ?> <div id="message" class="info"> <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> </div> <?php } ?> <div class="clear"></div> </div> <?php }
/** * Output a block of random friends. * * No longer used in BuddyPress. * * @todo Deprecate */ function bp_friends_random_friends() { if (!($friend_ids = wp_cache_get('friends_friend_ids_' . bp_displayed_user_id(), 'bp'))) { $friend_ids = BP_Friends_Friendship::get_random_friends(bp_displayed_user_id()); wp_cache_set('friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp'); } ?> <div class="info-group"> <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> <?php if ($friend_ids) { ?> <ul class="horiz-gallery"> <?php for ($i = 0, $count = count($friend_ids); $i < $count; ++$i) { ?> <li> <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> <h5><?php echo bp_core_get_userlink($friend_ids[$i]); ?> </h5> </li> <?php } ?> </ul> <?php } else { ?> <div id="message" class="info"> <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> </div> <?php } ?> <div class="clear"></div> </div> <?php }