bp_friends_random_friends()

Output a block of random friends.


Description Description

No longer used in BuddyPress.


Source Source

File: bp-friends/bp-friends-template.php

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
			/* translators: %s: member name */
			bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) );
			?>
			&nbsp;
			(<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ); ?>)
			&nbsp;
			<span>
				<a href="<?php echo trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() ) ?>">
					<?php esc_html_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
					/* translators: %s: member name */
					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
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.