本文整理汇总了PHP中BP_Groups_Member::total_group_count方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Member::total_group_count方法的具体用法?PHP BP_Groups_Member::total_group_count怎么用?PHP BP_Groups_Member::total_group_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Member
的用法示例。
在下文中一共展示了BP_Groups_Member::total_group_count方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_total_groups_for_user
/**
* Get the count of groups of which the specified user is a member.
*
* @param int $user_id Optional. Default: ID of the displayed user.
*
* @return int Group count.
*/
function groups_total_groups_for_user($user_id = 0)
{
if (empty($user_id)) {
$user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id();
}
$count = wp_cache_get('bp_total_groups_for_user_' . $user_id, 'bp');
if (false === $count) {
$count = BP_Groups_Member::total_group_count($user_id);
wp_cache_set('bp_total_groups_for_user_' . $user_id, $count, 'bp');
}
return $count;
}
示例2: bp_get_group_total_for_member
/**
* Get the group count for the displayed user.
*
* @since 1.1.0
*
* @return string
*/
function bp_get_group_total_for_member()
{
/**
* FIlters the group count for a displayed user.
*
* @since 1.1.0
*
* @param int $value Total group count for a displayed user.
*/
return apply_filters('bp_get_group_total_for_member', BP_Groups_Member::total_group_count());
}
示例3: the_invite
function the_invite()
{
global $group_id;
$this->in_the_loop = true;
$user_id = $this->next_invite();
$this->invite = new stdClass();
$this->invite->user = $this->invite_data[$user_id];
// This method previously populated the user object with
// BP_Core_User. We manually configure BP_Core_User data for
// backward compatibility.
if (bp_is_active('xprofile')) {
$this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user($user_id);
}
$this->invite->user->avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
$this->invite->user->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
$this->invite->user->avatar_mini = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname), 'width' => 30, 'height' => 30));
$this->invite->user->email = $this->invite->user->user_email;
$this->invite->user->user_url = bp_core_get_user_domain($user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);
$this->invite->user->user_link = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
$this->invite->user->last_active = bp_core_get_last_activity($this->invite->user->last_activity, __('active %s', 'buddypress'));
if (bp_is_active('groups')) {
$total_groups = BP_Groups_Member::total_group_count($user_id);
$this->invite->user->total_groups = sprintf(_n('%d group', '%d groups', $total_groups, 'buddypress'), $total_groups);
}
if (bp_is_active('friends')) {
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
}
if (bp_is_active('friends')) {
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
}
$this->invite->user->total_blogs = null;
$this->invite->group_id = $group_id;
// Globaled in bp_group_has_invites()
if (0 == $this->current_invite) {
// loop has just started
do_action('loop_start');
}
}
示例4: populate_extras
/**
* Populates extra fields such as group and friendship counts.
*/
public function populate_extras()
{
if (bp_is_active('friends')) {
$this->total_friends = BP_Friends_Friendship::total_friend_count($this->id);
}
if (bp_is_active('groups')) {
$this->total_groups = BP_Groups_Member::total_group_count($this->id);
$this->total_groups = sprintf(_n('%d group', '%d groups', $this->total_groups, 'buddypress'), $this->total_groups);
}
}
示例5: bp_get_group_total_for_member
function bp_get_group_total_for_member()
{
return apply_filters('bp_get_group_total_for_member', BP_Groups_Member::total_group_count());
}
示例6: populate_extras
function populate_extras()
{
global $bp;
if (function_exists('friends_install')) {
$this->total_friends = BP_Friends_Friendship::total_friend_count($this->id);
if ($this->total_friends) {
if (1 == $this->total_friends) {
$this->total_friends .= ' ' . __('friend', 'buddypress');
} else {
$this->total_friends .= ' ' . __('friends', 'buddypress');
}
$this->total_friends = '<a href="' . $this->user_url . $bp->friends->slug . '" title="' . sprintf(__("%s's friend list", 'buddypress'), $this->fullname) . '">' . $this->total_friends . '</a>';
}
}
if (function_exists('bp_blogs_install')) {
if ($this->total_blogs) {
if (1 == $this->total_blogs) {
$this->total_blogs .= ' ' . __('blog', 'buddypress');
} else {
$this->total_blogs .= ' ' . __('blogs', 'buddypress');
}
$this->total_blogs = '<a href="' . $this->user_url . $bp->blogs->slug . '" title="' . sprintf(__("%s's blog list", 'buddypress'), $this->fullname) . '">' . $this->total_blogs . '</a>';
}
}
if (function_exists('groups_install')) {
$this->total_groups = BP_Groups_Member::total_group_count($this->id);
if ($this->total_groups) {
if (1 == $this->total_groups) {
$this->total_groups .= ' ' . __('group', 'buddypress');
} else {
$this->total_groups .= ' ' . __('groups', 'buddypress');
}
$this->total_groups = '<a href="' . $this->user_url . $bp->groups->slug . '" title="' . sprintf(__("%s's group list", 'buddypress'), $this->fullname) . '">' . $this->total_groups . '</a>';
}
}
}
示例7: test_total_group_count_should_return_integer
/**
* @group total_group_count
* @ticket BP6813
*/
public function test_total_group_count_should_return_integer()
{
$this->assertInternalType('int', BP_Groups_Member::total_group_count(123));
}
示例8: groups_total_groups_for_user
function groups_total_groups_for_user( $user_id = false ) {
global $bp;
if ( !$user_id )
$user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id;
if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) {
$count = BP_Groups_Member::total_group_count( $user_id );
wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' );
}
return $count;
}
示例9: groups_total_groups_for_user
function groups_total_groups_for_user($user_id = 0)
{
global $bp;
if (!$user_id) {
$user_id = $bp->displayed_user->id ? $bp->displayed_user->id : $bp->loggedin_user->id;
}
if (!($count = nxt_cache_get('bp_total_groups_for_user_' . $user_id, 'bp'))) {
$count = BP_Groups_Member::total_group_count($user_id);
nxt_cache_set('bp_total_groups_for_user_' . $user_id, $count, 'bp');
}
return $count;
}
示例10: groups_total_groups_for_user
function groups_total_groups_for_user($user_id = false)
{
global $bp;
if (!$user_id) {
$user_id = $bp->displayed_user->id;
}
return BP_Groups_Member::total_group_count($user_id);
}
示例11: populate_extras
function populate_extras() {
global $bp;
if ( function_exists('friends_install') )
$this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
if ( function_exists('groups_install') ) {
$this->total_groups = BP_Groups_Member::total_group_count( $this->id );
if ( $this->total_groups ) {
if ( 1 == $this->total_groups )
$this->total_groups .= ' ' . __( 'group', 'buddypress' );
else
$this->total_groups .= ' ' . __( 'groups', 'buddypress' );
}
}
}
示例12: bp_groups_random_groups
function bp_groups_random_groups($total_groups = 5)
{
global $bp;
if (!($group_ids = wp_cache_get('groups_random_user_groups_' . $bp->displayed_user->id . '_' . $total_groups, 'bp'))) {
$group_ids = groups_get_random_groups_for_user($bp->displayed_user->id, $total_groups, 1);
wp_cache_set('groups_random_user_groups_' . $bp->displayed_user->id . '_' . $total_groups, $group_ids, 'bp');
}
?>
<div class="info-group">
<h4><?php
bp_word_or_name(__("My Groups", 'buddypress'), __("%s's Groups", 'buddypress'));
?>
(<?php
echo BP_Groups_Member::total_group_count();
?>
) <a href="<?php
echo $bp->displayed_user->domain . $bp->groups->slug;
?>
"><?php
_e('See All', 'buddypress');
?>
»</a></h4>
<?php
if ($group_ids) {
?>
<ul class="horiz-gallery">
<?php
for ($i = 0; $i < count($group_ids); $i++) {
if (!($group = wp_cache_get('groups_group_nouserdata_' . $group_ids[$i], 'bp'))) {
$group = new BP_Groups_Group($group_ids[$i], false, false);
wp_cache_set('groups_group_nouserdata_' . $group_ids[$i], $group, 'bp');
}
?>
<li>
<a href="<?php
echo bp_get_group_permalink($group);
?>
"><img src="<?php
echo attribute_escape($group->avatar_thumb);
?>
" class="avatar" alt="<?php
_e('Group Avatar', 'buddypress');
?>
" /></a>
<h5><a href="<?php
echo bp_get_group_permalink($group);
?>
"><?php
echo attribute_escape($group->name);
?>
</a></h5>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<div id="message" class="info">
<p><?php
bp_word_or_name(__("You haven't joined any groups yet.", 'buddypress'), __("%s hasn't joined any groups yet.", 'buddypress'));
?>
</p>
</div>
<?php
}
?>
<div class="clear"></div>
</div>
<?php
}
示例13: the_invite
/**
* Sets up the invite to show.
*
* @since 1.1.0
*/
public function the_invite()
{
global $group_id;
$this->in_the_loop = true;
$user_id = $this->next_invite();
$this->invite = new stdClass();
$this->invite->user = $this->invite_data[$user_id];
// This method previously populated the user object with
// BP_Core_User. We manually configure BP_Core_User data for
// backward compatibility.
if (bp_is_active('xprofile')) {
$this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user($user_id);
}
$this->invite->user->avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->invite->user->fullname)));
$this->invite->user->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->invite->user->fullname)));
$this->invite->user->avatar_mini = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Profile photo of %s', 'buddypress'), $this->invite->user->fullname), 'width' => 30, 'height' => 30));
$this->invite->user->email = $this->invite->user->user_email;
$this->invite->user->user_url = bp_core_get_user_domain($user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);
$this->invite->user->user_link = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
$this->invite->user->last_active = bp_core_get_last_activity($this->invite->user->last_activity, __('active %s', 'buddypress'));
if (bp_is_active('groups')) {
$total_groups = BP_Groups_Member::total_group_count($user_id);
$this->invite->user->total_groups = sprintf(_n('%d group', '%d groups', $total_groups, 'buddypress'), $total_groups);
}
if (bp_is_active('friends')) {
$this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
}
$this->invite->user->total_blogs = null;
// Global'ed in bp_group_has_invites()
$this->invite->group_id = $group_id;
// loop has just started
if (0 == $this->current_invite) {
/**
* Fires if the current invite item is the first in the loop.
*
* @since 1.1.0
* @since 2.3.0 `$this` parameter added.
* @since 2.7.0 Action renamed from `loop_start`.
*
* @param BP_Groups_Invite_Template $this Instance of the current Invites template.
*/
do_action('group_invitation_loop_start', $this);
}
}
示例14: groups_total_groups_for_user
function groups_total_groups_for_user($user_id = 0)
{
global $bp;
if (!$user_id) {
$user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id();
}
if (!($count = wp_cache_get('bp_total_groups_for_user_' . $user_id, 'bp'))) {
$count = BP_Groups_Member::total_group_count($user_id);
wp_cache_set('bp_total_groups_for_user_' . $user_id, $count, 'bp');
}
return $count;
}