本文整理汇总了PHP中bp_is_user_friends函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_user_friends函数的具体用法?PHP bp_is_user_friends怎么用?PHP bp_is_user_friends使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_user_friends函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_get_the_body_class
function bp_get_the_body_class($nxt_classes, $custom_classes = false)
{
$bp_classes = array();
/** Pages *************************************************************/
if (is_front_page()) {
$bp_classes[] = 'home-page';
}
if (bp_is_directory()) {
$bp_classes[] = 'directory';
}
if (bp_is_single_item()) {
$bp_classes[] = 'single-item';
}
/** Components ********************************************************/
if (!bp_is_blog_page()) {
if (bp_is_user_profile()) {
$bp_classes[] = 'xprofile';
}
if (bp_is_activity_component()) {
$bp_classes[] = 'activity';
}
if (bp_is_blogs_component()) {
$bp_classes[] = 'blogs';
}
if (bp_is_messages_component()) {
$bp_classes[] = 'messages';
}
if (bp_is_friends_component()) {
$bp_classes[] = 'friends';
}
if (bp_is_groups_component()) {
$bp_classes[] = 'groups';
}
if (bp_is_settings_component()) {
$bp_classes[] = 'settings';
}
}
/** User **************************************************************/
if (!bp_is_directory()) {
if (bp_is_user_blogs()) {
$bp_classes[] = 'my-blogs';
}
if (bp_is_user_groups()) {
$bp_classes[] = 'my-groups';
}
if (bp_is_user_activity()) {
$bp_classes[] = 'my-activity';
}
}
if (bp_is_my_profile()) {
$bp_classes[] = 'my-account';
}
if (bp_is_user_profile()) {
$bp_classes[] = 'my-profile';
}
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
}
if (bp_is_user_messages()) {
$bp_classes[] = 'my-messages';
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
if (is_user_logged_in()) {
$bp_classes[] = 'logged-in';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
//.........这里部分代码省略.........
示例2: bp_get_the_body_class
/**
* Customize the body class, according to the currently displayed BP content.
*
* Uses the above is_() functions to output a body class for each scenario.
*
* @since 1.1.0
*
* @param array $wp_classes The body classes coming from WP.
* @param array|bool $custom_classes Classes that were passed to get_body_class().
* @return array $classes The BP-adjusted body classes.
*/
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false)
{
$bp_classes = array();
/* Pages *************************************************************/
if (is_front_page()) {
$bp_classes[] = 'home-page';
}
if (bp_is_directory()) {
$bp_classes[] = 'directory';
}
if (bp_is_single_item()) {
$bp_classes[] = 'single-item';
}
/* Components ********************************************************/
if (!bp_is_blog_page()) {
if (bp_is_user_profile()) {
$bp_classes[] = 'xprofile';
}
if (bp_is_activity_component()) {
$bp_classes[] = 'activity';
}
if (bp_is_blogs_component()) {
$bp_classes[] = 'blogs';
}
if (bp_is_messages_component()) {
$bp_classes[] = 'messages';
}
if (bp_is_friends_component()) {
$bp_classes[] = 'friends';
}
if (bp_is_groups_component()) {
$bp_classes[] = 'groups';
}
if (bp_is_settings_component()) {
$bp_classes[] = 'settings';
}
}
/* User **************************************************************/
if (bp_is_user()) {
$bp_classes[] = 'bp-user';
// Add current user member types.
if ($member_types = bp_get_member_type(bp_displayed_user_id(), false)) {
foreach ($member_types as $member_type) {
$bp_classes[] = sprintf('member-type-%s', esc_attr($member_type));
}
}
}
if (!bp_is_directory()) {
if (bp_is_user_blogs()) {
$bp_classes[] = 'my-blogs';
}
if (bp_is_user_groups()) {
$bp_classes[] = 'my-groups';
}
if (bp_is_user_activity()) {
$bp_classes[] = 'my-activity';
}
} else {
if (bp_get_current_member_type()) {
$bp_classes[] = 'type';
}
}
if (bp_is_my_profile()) {
$bp_classes[] = 'my-account';
}
if (bp_is_user_profile()) {
$bp_classes[] = 'my-profile';
}
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
}
if (bp_is_user_messages()) {
$bp_classes[] = 'my-messages';
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
//.........这里部分代码省略.........
示例3: test_member_friends
function test_member_friends()
{
$this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_friends_slug());
$this->assertTrue(bp_is_user_friends());
}
示例4: bp_follow_set_members_scope_default
/**
* Set some default parameters for a member loop.
*
* If we're on a user's following or followers page, set the member filter
* so users are sorted by newest follows instead of last active.
*
* If we're on a user's friends page or the members directory, reset the
* members filter to last active.
*
* Only applicable for BuddyPress 1.7+.
*
* @since 1.3.0
*
* @see bp_follow_add_members_dropdown_filter()
*/
function bp_follow_set_members_scope_default()
{
// don't do this for older versions of BP
if (!class_exists('BP_User_Query')) {
return;
}
// set default members filter to 'newest-follows' on member follow pages
if (bp_is_user() && (bp_is_current_action('following') || bp_is_current_action('followers'))) {
// set the members filter to 'newest-follows' by faking an ajax request (loophole!)
$_POST['cookie'] = 'bp-members-filter%3Dnewest-follows';
// reset the dropdown menu to 'Newest Follows'
@setcookie('bp-members-filter', 'newest-follows', 0, '/');
// reset members filter on the user friends and members directory page
// this is done b/c the 'newest-follows' filter does not apply on these pages
} elseif (bp_is_user_friends() || !bp_is_user() && bp_is_members_component()) {
// set the members filter to 'newest' by faking an ajax request (loophole!)
$_POST['cookie'] = 'bp-members-filter%3Dactive';
// reset the dropdown menu to 'Last Active'
@setcookie('bp-members-filter', 'active', 0, '/');
}
}
示例5: suffusion_bp_content_class
/**
* Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP.
* This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so
* that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older
* version of the BP pack.
*
* @since 3.6.7
* @param bool $custom
* @param bool $echo
* @return bool|string
*/
function suffusion_bp_content_class($custom = false, $echo = true)
{
if (!function_exists('bp_is_group')) {
return false;
}
$css = array();
$css[] = 'post';
if (function_exists('bp_is_profile_component') && bp_is_profile_component()) {
$css[] = 'profile-component';
}
if (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
$css[] = 'activity-component';
}
if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) {
$css[] = 'blogs-component';
}
if (function_exists('bp_is_messages_component') && bp_is_messages_component()) {
$css[] = 'messages-component';
}
if (function_exists('bp_is_friends_component') && bp_is_friends_component()) {
$css[] = 'friends-component';
}
if (function_exists('bp_is_groups_component') && bp_is_groups_component()) {
$css[] = 'groups-component';
}
if (function_exists('bp_is_settings_component') && bp_is_settings_component()) {
$css[] = 'settings-component';
}
if (function_exists('bp_is_member') && bp_is_member()) {
$css[] = 'member';
}
if (function_exists('bp_is_user_activity') && bp_is_user_activity()) {
$css[] = 'user-activity';
}
if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) {
$css[] = 'user-friends-activity';
}
if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) {
$css[] = 'activity-permalink';
}
if (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
$css[] = 'user-profile';
}
if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) {
$css[] = 'profile-edit';
}
if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) {
$css[] = 'change-avatar';
}
if (function_exists('bp_is_user_groups') && bp_is_user_groups()) {
$css[] = 'user-groups';
}
if (function_exists('bp_is_group') && bp_is_group()) {
$css[] = 'group';
}
if (function_exists('bp_is_group_home') && bp_is_group_home()) {
$css[] = 'group-home';
}
if (function_exists('bp_is_group_create') && bp_is_group_create()) {
$css[] = 'group-create';
}
if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) {
$css[] = 'group-admin-page';
}
if (function_exists('bp_is_group_forum') && bp_is_group_forum()) {
$css[] = 'group-forum';
}
if (function_exists('bp_is_group_activity') && bp_is_group_activity()) {
$css[] = 'group-activity';
}
if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) {
$css[] = 'group-forum-topic';
}
if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) {
$css[] = 'group-forum-topic-edit';
}
if (function_exists('bp_is_group_members') && bp_is_group_members()) {
$css[] = 'group-members';
}
if (function_exists('bp_is_group_invites') && bp_is_group_invites()) {
$css[] = 'group-invites';
}
if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) {
$css[] = 'group-membership-request';
}
if (function_exists('bp_is_group_leave') && bp_is_group_leave()) {
$css[] = 'group-leave';
}
if (function_exists('bp_is_group_single') && bp_is_group_single()) {
//.........这里部分代码省略.........
示例6: miss_is_bp
/**
*
*/
function miss_is_bp()
{
if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
return true;
}
return false;
}
示例7: bp_get_the_body_class
function bp_get_the_body_class($wp_classes = array(), $custom_classes = false)
{
$bp_classes = array();
/** Pages *************************************************************/
if (is_front_page()) {
$bp_classes[] = 'home-page';
}
if (bp_is_directory()) {
$bp_classes[] = 'directory';
}
if (bp_is_single_item()) {
$bp_classes[] = 'single-item';
}
/** Components ********************************************************/
if (!bp_is_blog_page()) {
if (bp_is_user_profile()) {
$bp_classes[] = 'xprofile';
}
if (bp_is_activity_component()) {
$bp_classes[] = 'activity';
}
if (bp_is_blogs_component()) {
$bp_classes[] = 'blogs';
}
if (bp_is_messages_component()) {
$bp_classes[] = 'messages';
}
if (bp_is_friends_component()) {
$bp_classes[] = 'friends';
}
if (bp_is_groups_component()) {
$bp_classes[] = 'groups';
}
if (bp_is_settings_component()) {
$bp_classes[] = 'settings';
}
}
/** User **************************************************************/
if (bp_is_user()) {
$bp_classes[] = 'bp-user';
}
if (!bp_is_directory()) {
if (bp_is_user_blogs()) {
$bp_classes[] = 'my-blogs';
}
if (bp_is_user_groups()) {
$bp_classes[] = 'my-groups';
}
if (bp_is_user_activity()) {
$bp_classes[] = 'my-activity';
}
}
if (bp_is_my_profile()) {
$bp_classes[] = 'my-account';
}
if (bp_is_user_profile()) {
$bp_classes[] = 'my-profile';
}
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
}
if (bp_is_user_messages()) {
$bp_classes[] = 'my-messages';
}
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
}
if (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
}
if (bp_is_user_groups_activity()) {
$bp_classes[] = 'groups-activity';
}
/** Messages **********************************************************/
if (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
}
if (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
}
if (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
}
if (bp_is_notices()) {
$bp_classes[] = 'notices';
}
if (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
}
if (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
//.........这里部分代码省略.........
示例8: do_action
</div>
</div>
<!-- #item-nav -->
</div>
<div id="item-body" role="main" class="col-sm-12">
<?php
do_action('bp_before_member_body');
if (bp_is_user_activity() || !bp_current_component()) {
bp_get_template_part('members/single/activity');
} elseif (bp_is_user_blogs()) {
bp_get_template_part('members/single/blogs');
} elseif (bp_is_user_friends()) {
bp_get_template_part('members/single/friends');
} elseif (bp_is_user_groups()) {
bp_get_template_part('members/single/groups');
} elseif (bp_is_user_messages()) {
bp_get_template_part('members/single/messages');
} elseif (bp_is_user_profile()) {
bp_get_template_part('members/single/profile');
} elseif (bp_is_user_forums()) {
bp_get_template_part('members/single/forums');
} elseif (bp_is_user_notifications()) {
bp_get_template_part('members/single/notifications');
} elseif (bp_is_user_settings()) {
bp_get_template_part('members/single/settings');
// If nothing sticks, load a generic template
} else {
示例9: shoestrap_is_bp
/**
* Check if this is a BuddyPress page or not.
* Returns true or false (boolean)
*/
function shoestrap_is_bp()
{
$bp = false;
/** Pages *************************************************************/
if (!$bp && bp_is_directory()) {
$bp = true;
} elseif (!$bp && bp_is_single_item()) {
$bp = true;
} elseif (!$bp && bp_is_user_profile()) {
$bp = true;
} elseif (!$bp && bp_is_activity_component()) {
$bp = true;
} elseif (!$bp && bp_is_blogs_component()) {
$bp = true;
} elseif (!$bp && bp_is_messages_component()) {
$bp = true;
} elseif (!$bp && bp_is_friends_component()) {
$bp = true;
} elseif (!$bp && bp_is_groups_component()) {
$bp = true;
} elseif (!$bp && bp_is_settings_component()) {
$bp = true;
} elseif (!$bp && bp_is_user()) {
$bp = true;
} elseif (!$bp && bp_is_user_blogs()) {
$bp = true;
} elseif (!$bp && bp_is_user_groups()) {
$bp = true;
} elseif (!$bp && bp_is_user_activity()) {
$bp = true;
} elseif (!$bp && bp_is_my_profile()) {
$bp = true;
} elseif (!$bp && bp_is_user_profile()) {
$bp = true;
} elseif (!$bp && bp_is_user_friends()) {
$bp = true;
} elseif (!$bp && bp_is_user_messages()) {
$bp = true;
} elseif (!$bp && bp_is_user_recent_commments()) {
$bp = true;
} elseif (!$bp && bp_is_user_recent_posts()) {
$bp = true;
} elseif (!$bp && bp_is_user_change_avatar()) {
$bp = true;
} elseif (!$bp && bp_is_user_profile_edit()) {
$bp = true;
} elseif (!$bp && bp_is_user_friends_activity()) {
$bp = true;
} elseif (!$bp && bp_is_user_groups_activity()) {
$bp = true;
} elseif (!$bp && is_user_logged_in()) {
$bp = true;
} elseif (!$bp && bp_is_messages_inbox()) {
$bp = true;
} elseif (!$bp && bp_is_messages_sentbox()) {
$bp = true;
} elseif (!$bp && bp_is_messages_compose_screen()) {
$bp = true;
} elseif (!$bp && bp_is_notices()) {
$bp = true;
} elseif (!$bp && bp_is_user_friend_requests()) {
$bp = true;
} elseif (!$bp && bp_is_create_blog()) {
$bp = true;
} elseif (!$bp && bp_is_group_leave()) {
$bp = true;
} elseif (!$bp && bp_is_group_invites()) {
$bp = true;
} elseif (!$bp && bp_is_group_members()) {
$bp = true;
} elseif (!$bp && bp_is_group_forum_topic()) {
$bp = true;
} elseif (!$bp && bp_is_group_forum_topic_edit()) {
$bp = true;
} elseif (!$bp && bp_is_group_forum()) {
$bp = true;
} elseif (!$bp && bp_is_group_admin_page()) {
$bp = true;
} elseif (!$bp && bp_is_group_create()) {
$bp = true;
} elseif (!$bp && bp_is_group_home()) {
$bp = true;
} elseif (!$bp && bp_is_single_activity()) {
$bp = true;
} elseif (!$bp && bp_is_register_page()) {
$bp = true;
} elseif (!$bp && bp_is_activation_page()) {
$bp = true;
} elseif (!$bp && !bp_is_blog_page()) {
$bp = true;
}
return $bp;
}
示例10: body_class
function body_class($wp_classes, $custom_classes = false)
{
global $bp;
$bp_classes = array();
if (bp_is_directory()) {
$bp_classes[] = 'directory';
} elseif (bp_is_single_item()) {
$bp_classes[] = 'single-item';
} elseif (bp_is_activity_component() || $this->show_activity_page) {
$bp_classes[] = 'activity';
}
if ($this->adminbar && $this->theme->have_adminbar()) {
$bp_classes[] = 'adminbar';
}
if (!is_page() && is_front_page() && is_file(CHILD_DIR . '/home.php')) {
$bp_classes[] = 'home';
}
if ($this->show_activity_page) {
$bp_classes[] = 'internal-page';
} elseif (!bp_is_blog_page()) {
$wp_classes = array();
if (!bp_is_directory()) {
$bp_classes[] = 'internal-page';
}
if (bp_is_user_profile()) {
$bp_classes[] = 'profile';
} elseif (bp_is_blogs_component()) {
$bp_classes[] = 'blogs';
} elseif (bp_is_messages_component()) {
$bp_classes[] = 'messages';
} elseif (bp_is_friends_component()) {
$bp_classes[] = 'friends';
} elseif (bp_is_groups_component()) {
$bp_classes[] = 'groups';
} elseif (bp_is_settings_component()) {
$bp_classes[] = 'settings';
}
}
if (is_user_logged_in()) {
$bp_classes[] = 'logged-in';
if (!bp_is_directory()) {
if (bp_is_user_friends()) {
$bp_classes[] = 'my-friends';
} elseif (bp_is_user_activity()) {
$bp_classes[] = 'my-activity';
} elseif (bp_is_user_blogs()) {
$bp_classes[] = 'my-blogs';
} elseif (bp_is_user_groups()) {
$bp_classes[] = 'my-groups';
} elseif (bp_is_messages_inbox()) {
$bp_classes[] = 'inbox';
} elseif (bp_is_messages_sentbox()) {
$bp_classes[] = 'sentbox';
} elseif (bp_is_messages_compose_screen()) {
$bp_classes[] = 'compose';
} elseif (bp_is_notices()) {
$bp_classes[] = 'notices';
} elseif (bp_is_user_friend_requests()) {
$bp_classes[] = 'friend-requests';
} elseif (bp_is_create_blog()) {
$bp_classes[] = 'create-blog';
} elseif (bp_is_group_leave()) {
$bp_classes[] = 'leave-group';
} elseif (bp_is_group_invites()) {
$bp_classes[] = 'group-invites';
} elseif (bp_is_group_forum_topic_edit()) {
$bp_classes[] = 'group-forum-topic-edit';
} elseif (bp_is_group_admin_page()) {
$bp_classes[] = 'group-admin';
} elseif (bp_is_group_create()) {
$bp_classes[] = 'group-create';
} elseif (bp_is_user_change_avatar()) {
$bp_classes[] = 'change-avatar';
} elseif (bp_is_user_profile_edit()) {
$bp_classes[] = 'profile-edit';
}
}
} else {
$bp_classes[] = 'visitor';
}
if (bp_is_group_members()) {
$bp_classes[] = 'group-members';
} elseif (bp_is_group_home()) {
$bp_classes[] = 'group-home';
} elseif (bp_is_group_forum()) {
$bp_classes[] = 'group-forum';
if (bp_is_group_forum_topic()) {
$bp_classes[] = 'group-forum-topic';
}
} else {
if (bp_is_user_recent_commments()) {
$bp_classes[] = 'recent-comments';
}
if (bp_is_user_recent_posts()) {
$bp_classes[] = 'recent-posts';
}
if (bp_is_user_friends_activity()) {
$bp_classes[] = 'friends-activity';
} elseif (bp_is_single_activity()) {
$bp_classes[] = 'activity-permalink';
//.........这里部分代码省略.........
示例11: bp_has_members
/**
* Initialize the members loop.
*
* Based on the $args passed, bp_has_members() populates the $members_template
* global, enabling the use of BuddyPress templates and template functions to
* display a list of members.
*
* @global object $members_template {@link BP_Members_Template}
*
* @param array $args {
* Arguments for limiting the contents of the members loop. Most arguments
* are in the same format as {@link BP_User_Query}. However, because
* the format of the arguments accepted here differs in a number of ways,
* and because bp_has_members() determines some default arguments in a
* dynamic fashion, we list all accepted arguments here as well.
*
* Arguments can be passed as an associative array, or as a URL query
* string (eg, 'user_id=4&per_page=3').
*
* @type int $type Sort order. Accepts 'active', 'random', 'newest', 'popular',
* 'online', 'alphabetical'. Default: 'active'.
* @type int|bool $page Page of results to display. Default: 1.
* @type int|bool $per_page Number of results per page. Default: 20.
* @type int|bool $max Maximum number of results to return. Default: false (unlimited).
* @type string $page_arg The string used as a query parameter in pagination links.
* Default: 'bpage'.
* @type array|int|string|bool $include Limit results by a list of user IDs. Accepts an array, a
* single integer, a comma-separated list of IDs, or false (to
* disable this limiting). Accepts 'active', 'alphabetical',
* 'newest', or 'random'. Default: false.
* @type array|int|string|bool $exclude Exclude users from results by ID. Accepts an array, a single
* integer, a comma-separated list of IDs, or false (to disable
* this limiting). Default: false.
* @type int $user_id If provided, results are limited to the friends of the specified
* user. When on a user's Friends page, defaults to the ID of the
* displayed user. Otherwise defaults to 0.
* @type string|array $member_type Array or comma-separated list of member types to limit results to.
* @type string $search_terms Limit results by a search term. Default: null.
* @type string $meta_key Limit results by the presence of a usermeta key.
* Default: false.
* @type mixed $meta_value When used with meta_key, limits results by the
* a matching usermeta value. Default: false.
* @type bool $populate_extras Whether to fetch optional data, such as
* friend counts. Default: true.
* }
* @return bool Returns true when blogs are found, otherwise false.
*/
function bp_has_members( $args = '' ) {
global $members_template;
// Default user ID
$user_id = 0;
// User filtering
if ( bp_is_user_friends() && ! bp_is_user_friend_requests() ) {
$user_id = bp_displayed_user_id();
}
// type: active ( default ) | random | newest | popular | online | alphabetical
$r = bp_parse_args( $args, array(
'type' => 'active',
'page' => 1,
'per_page' => 20,
'max' => false,
'page_arg' => 'upage', // See https://buddypress.trac.wordpress.org/ticket/3679
'include' => false, // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users
'exclude' => false, // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users
'user_id' => $user_id, // Pass a user_id to only show friends of this user
'member_type' => '',
'search_terms' => null, // Pass search_terms to filter users by their profile data
'meta_key' => false, // Only return users with this usermeta
'meta_value' => false, // Only return users where the usermeta value matches. Requires meta_key
'populate_extras' => true // Fetch usermeta? Friend count, last active etc.
), 'has_members' );
// Pass a filter if ?s= is set.
if ( is_null( $r['search_terms'] ) ) {
if ( !empty( $_REQUEST['s'] ) ) {
$r['search_terms'] = $_REQUEST['s'];
} else {
$r['search_terms'] = false;
}
}
// Set per_page to max if max is larger than per_page
if ( !empty( $r['max'] ) && ( $r['per_page'] > $r['max'] ) ) {
$r['per_page'] = $r['max'];
}
// Query for members and populate $members_template global
$members_template = new BP_Core_Members_Template(
$r['type'],
$r['page'],
$r['per_page'],
$r['max'],
//.........这里部分代码省略.........
示例12: bp_checkins_add_friend_position
function bp_checkins_add_friend_position()
{
if ((int) bp_get_option('bp-checkins-disable-geo-friends')) {
return false;
}
if ((int) bp_get_option('bp-checkins-disable-activity-checkins') && (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component'))) {
return false;
}
if (bp_is_user_friends()) {
$user_id = bp_get_member_user_id();
$lat = bp_get_user_meta($user_id, 'bpci_latest_lat', true);
$lng = bp_get_user_meta($user_id, 'bpci_latest_lng', true);
$address = bp_get_user_meta($user_id, 'bpci_latest_address', true);
if ($lat && $lng && $address) {
?>
<div class="activity-checkin">
<a href="#bpci-map" title="<?php
_e('Center the map on this friend', 'bp-checkins');
?>
" id="friend-<?php
echo $user_id;
?>
" rel="<?php
echo $lat . ',' . $lng;
?>
" class="link-checkin"><span class="update-checkin"><?php
echo stripslashes($address);
?>
</span></a>
</div>
<?php
}
}
}
示例13: bp_has_members
function bp_has_members($args = '')
{
global $members_template;
/***
* Set the defaults based on the current page. Any of these will be overridden
* if arguments are directly passed into the loop. Custom plugins should always
* pass their parameters directly to the loop.
*/
$type = 'active';
$user_id = 0;
$page = 1;
$search_terms = null;
// User filtering
if (bp_is_user_friends() && !bp_is_user_friend_requests()) {
$user_id = bp_displayed_user_id();
}
// type: active ( default ) | random | newest | popular | online | alphabetical
$defaults = array('type' => $type, 'page' => $page, 'per_page' => 20, 'max' => false, 'page_arg' => 'upage', 'include' => false, 'exclude' => false, 'user_id' => $user_id, 'search_terms' => $search_terms, 'meta_key' => false, 'meta_value' => false, 'populate_extras' => true);
$r = wp_parse_args($args, $defaults);
extract($r);
// Pass a filter if ?s= is set.
if (is_null($search_terms)) {
if (!empty($_REQUEST['s'])) {
$search_terms = $_REQUEST['s'];
} else {
$search_terms = false;
}
}
// Set per_page to max if max is larger than per_page
if (!empty($max) && $per_page > $max) {
$per_page = $max;
}
$members_template = new BP_Core_Members_Template($type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool) $populate_extras, $exclude, $meta_key, $meta_value, $page_arg);
return apply_filters('bp_has_members', $members_template->has_members(), $members_template);
}
示例14: bp_has_members
/**
* Initialize the members loop.
*
* Based on the $args passed, bp_has_members() populates the $members_template
* global, enabling the use of BuddyPress templates and template functions to
* display a list of members.
*
* @global object $members_template {@link BP_Members_Template}
*
* @param array|string $args {
* Arguments for limiting the contents of the members loop. Most arguments
* are in the same format as {@link BP_User_Query}. However, because
* the format of the arguments accepted here differs in a number of ways,
* and because bp_has_members() determines some default arguments in a
* dynamic fashion, we list all accepted arguments here as well.
*
* Arguments can be passed as an associative array, or as a URL query
* string (eg, 'user_id=4&per_page=3').
*
* @type int $type Sort order. Accepts 'active', 'random', 'newest', 'popular',
* 'online', 'alphabetical'. Default: 'active'.
* @type int|bool $page Page of results to display. Default: 1.
* @type int|bool $per_page Number of results per page. Default: 20.
* @type int|bool $max Maximum number of results to return. Default: false (unlimited).
* @type string $page_arg The string used as a query parameter in pagination links.
* Default: 'bpage'.
* @type array|int|string|bool $include Limit results by a list of user IDs. Accepts an array, a
* single integer, a comma-separated list of IDs, or false (to
* disable this limiting). Accepts 'active', 'alphabetical',
* 'newest', or 'random'. Default: false.
* @type array|int|string|bool $exclude Exclude users from results by ID. Accepts an array, a single
* integer, a comma-separated list of IDs, or false (to disable
* this limiting). Default: false.
* @type int $user_id If provided, results are limited to the friends of the specified
* user. When on a user's Friends page, defaults to the ID of the
* displayed user. Otherwise defaults to 0.
* @type string|array $member_type Array or comma-separated list of member types to limit
* results to.
* @type string|array $member_type__in Array or comma-separated list of member types to limit
* results to.
* @type string|array $member_type__not_in Array or comma-separated list of member types to exclude
* from results.
* @type string $search_terms Limit results by a search term. Default: value of
* `$_REQUEST['members_search']` or `$_REQUEST['s']`, if present.
* Otherwise false.
* @type string $meta_key Limit results by the presence of a usermeta key.
* Default: false.
* @type mixed $meta_value When used with meta_key, limits results by the a matching
* usermeta value. Default: false.
* @type bool $populate_extras Whether to fetch optional data, such as friend counts.
* Default: true.
* }
* @return bool Returns true when blogs are found, otherwise false.
*/
function bp_has_members($args = '')
{
global $members_template;
// Default user ID.
$user_id = 0;
// User filtering.
if (bp_is_user_friends() && !bp_is_user_friend_requests()) {
$user_id = bp_displayed_user_id();
}
$member_type = bp_get_current_member_type();
if (!$member_type && !empty($_GET['member_type'])) {
if (is_array($_GET['member_type'])) {
$member_type = $_GET['member_type'];
} else {
// Can be a comma-separated list.
$member_type = explode(',', $_GET['member_type']);
}
}
$search_terms_default = null;
$search_query_arg = bp_core_get_component_search_query_arg('members');
if (!empty($_REQUEST[$search_query_arg])) {
$search_terms_default = stripslashes($_REQUEST[$search_query_arg]);
}
// Type: active ( default ) | random | newest | popular | online | alphabetical.
$r = bp_parse_args($args, array('type' => 'active', 'page' => 1, 'per_page' => 20, 'max' => false, 'page_arg' => 'upage', 'include' => false, 'exclude' => false, 'user_id' => $user_id, 'member_type' => $member_type, 'member_type__in' => '', 'member_type__not_in' => '', 'search_terms' => $search_terms_default, 'meta_key' => false, 'meta_value' => false, 'populate_extras' => true), 'has_members');
// Pass a filter if ?s= is set.
if (is_null($r['search_terms'])) {
if (!empty($_REQUEST['s'])) {
$r['search_terms'] = $_REQUEST['s'];
} else {
$r['search_terms'] = false;
}
}
// Set per_page to max if max is larger than per_page.
if (!empty($r['max']) && $r['per_page'] > $r['max']) {
$r['per_page'] = $r['max'];
}
// Query for members and populate $members_template global.
$members_template = new BP_Core_Members_Template($r['type'], $r['page'], $r['per_page'], $r['max'], $r['user_id'], $r['search_terms'], $r['include'], $r['populate_extras'], $r['exclude'], $r['meta_key'], $r['meta_value'], $r['page_arg'], $r['member_type'], $r['member_type__in'], $r['member_type__not_in']);
/**
* Filters whether or not BuddyPress has members to iterate over.
*
* @since 1.2.4
*
* @param bool $value Whether or not there are members to iterate over.
* @param array $members_template Populated $members_template global.
//.........这里部分代码省略.........
示例15: do_action
<?php do_action( 'bp_member_options_nav' ) ?>
</ul>
</div>
</div><!-- #item-nav -->
<div id="item-body">
<?php do_action( 'bp_before_member_body' ) ?>
<?php if ( bp_is_user_activity() || !bp_current_component() ) : ?>
<?php locate_template( array( 'members/single/activity.php' ), true ) ?>
<?php elseif ( bp_is_user_blogs() ) : ?>
<?php locate_template( array( 'members/single/blogs.php' ), true ) ?>
<?php elseif ( bp_is_user_friends() ) : ?>
<?php locate_template( array( 'members/single/friends.php' ), true ) ?>
<?php elseif ( bp_is_user_groups() ) : ?>
<?php locate_template( array( 'members/single/groups.php' ), true ) ?>
<?php elseif ( bp_is_user_messages() ) : ?>
<?php locate_template( array( 'members/single/messages.php' ), true ) ?>
<?php elseif ( bp_is_user_profile() ) : ?>
<?php locate_template( array( 'members/single/profile.php' ), true ) ?>
<?php else : ?>
<?php
/* If nothing sticks, just load a member front template if one exists. */
locate_template( array( 'members/single/front.php' ), true );