本文整理汇总了PHP中BP_Friends_Friendship::get_random_friends方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Friends_Friendship::get_random_friends方法的具体用法?PHP BP_Friends_Friendship::get_random_friends怎么用?PHP BP_Friends_Friendship::get_random_friends使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Friends_Friendship
的用法示例。
在下文中一共展示了BP_Friends_Friendship::get_random_friends方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_friends_random_friends
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
}
示例2: bp_friends_random_friends
/**
* 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
}