本文整理汇总了PHP中bp_has_members函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_has_members函数的具体用法?PHP bp_has_members怎么用?PHP bp_has_members使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_has_members函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Displays the widget.
*/
function widget($args, $instance)
{
// do not do anything if user isn't logged in
if (!is_user_logged_in()) {
return;
}
if (empty($instance['max_users'])) {
$instance['max_users'] = 16;
}
// logged-in user isn't following anyone, so stop!
if (!($following = bp_get_following_ids(array('user_id' => bp_loggedin_user_id())))) {
return false;
}
// show the users the logged-in user is following
if (bp_has_members(array('include' => $following, 'max' => $instance['max_users'], 'populate_extras' => false))) {
do_action('bp_before_following_widget');
echo $args['before_widget'];
echo $args['before_title'] . $instance['title'] . $args['after_title'];
?>
<div class="avatar-block">
<?php
while (bp_members()) {
bp_the_member();
?>
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
"><?php
bp_member_avatar();
?>
</a>
</div>
<?php
}
?>
</div>
<?php
echo $args['after_widget'];
?>
<?php
do_action('bp_after_following_widget');
?>
<?php
}
}
示例2: bpChat_displayGroupChatAdmin
function bpChat_displayGroupChatAdmin()
{
global $bp;
global $members_template;
?>
<script>
jQuery(document).ready(function() {
jQuery('div#item-nav').before("<div id='bp-group-chat-online'><p id='bp-group-chat-online-text'><?php
_e("Admin is offline", "bp-chat");
?>
</p></div>");
<?php
if (function_exists('bp_has_members')) {
if (bp_has_members('user_id=0&type=online&per_page=' . $instance['max_members'] . '&max=' . $instance['max_members'] . '&populate_extras=0')) {
while (bp_members()) {
bp_the_member();
if ($members_template->member->id == $bp->groups->current_group->admins[0]->user_id && ($bp->groups->current_group->admins[0]->is_admin == 1 || $bp->groups->current_group->admins[0]->is_mod == 1)) {
?>
jQuery('div#bp-group-chat-online').html("<p id='bp-group-chat-online-text'><?php
_e("Admin is online", "bp-chat");
?>
</p>");
if ( (int)get_site_option( 'bp-chat-setting-disable-shoutbox-chat' ) == 0 ) {
jQuery('#shoutboxwrapper').show('slow');
}
<?php
}
}
} else {
?>
jQuery('div#bp-group-chat-online').html("<p id='bp-group-chat-online-text'><?php
_e("There are no admin users currently online", "bp-chat");
?>
</p>");
<?php
}
}
?>
jQuery('div#bp-group-chat-online').append("<?php
echo "<br />";
?>
");
});
</script>
<?php
}
示例3: test_should_contain_member_type_classes
/**
* @ticket BP6996
*/
public function test_should_contain_member_type_classes()
{
buddypress()->members->types = array();
bp_register_member_type('foo');
bp_register_member_type('bar');
$u = $this->factory->user->create();
bp_set_member_type($u, 'bar');
if (bp_has_members(array('include' => array($u)))) {
while (bp_members()) {
bp_the_member();
$found = bp_get_member_class();
}
}
global $members_template;
unset($members_template);
buddypress()->members->types = array();
$this->assertContains('member-type-bar', $found);
$this->assertNotContains('member-type-foo', $found);
}
示例4: while
?>
</h2>
</div><!--#counter-->
<?php
}
?>
<?php
if (of_get_option('members_avatars')) {
?>
<div id="intro-mem">
<?php
if (bp_has_members('max=12&type=' . of_get_option('members_type_select'))) {
?>
<?php
while (bp_members()) {
bp_the_member();
?>
<?php
if (bp_get_user_has_avatar()) {
?>
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
示例5: get_members
function get_members()
{
// Depends on BuddyPress
if (!class_exists('BuddyPress')) {
return false;
}
// Try to retrieve the widget from the cache
$widget = wp_cache_get('online_members', 'apoc');
if ($widget) {
$this->html = $widget;
$this->cached = true;
} else {
// Setup query args
$args = array('type' => 'online', 'per_page' => $this->number, 'populate_extras' => false);
// If topics are found, build the HTML
if (bp_has_members($args)) {
$this->html = $this->build_html();
// Store the new HTML in the cache with 1 minute expiration
wp_cache_set('online_members', $this->html, 'apoc', 60);
}
}
}
示例6: edit_view_link
?>
<?php
function edit_view_link( $view_link ){
return str_replace( __( 'View', 'buddypress' ), __( '+ more', 'yit' ), $view_link );
}
add_filter('bp_get_member_latest_update', 'edit_view_link');
wp_enqueue_script( 'jquery-masonry' );
?>
<?php do_action( 'bp_before_members_loop' ); ?>
<?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
<div id="pag-top" class="pagination">
<div class="pag-count" id="member-dir-count-top">
<?php bp_members_pagination_count(); ?>
</div>
<div class="pagination-links" id="member-dir-pag-top">
<?php bp_members_pagination_links(); ?>
</div>
示例7: _e
}
?>
</div>
<?php
if (bp_group_has_moderators()) {
?>
<div class="bp-widget">
<h4><?php
_e('Moderators', 'buddypress');
?>
</h4>
<?php
if (bp_has_members('&include=' . bp_group_mod_ids())) {
?>
<ul id="mods-list" class="item-list">
<?php
while (bp_members()) {
bp_the_member();
?>
<li>
<?php
echo bp_core_fetch_avatar(array('item_id' => bp_get_member_user_id(), 'type' => 'thumb', 'width' => 30, 'height' => 30, 'alt' => __('Profile picture of %s', 'buddypress')));
?>
<h5>
<a href="<?php
bp_member_permalink();
示例8: friends_get_friends_invite_list
/**
* Get a list of friends that a user can invite into this group.
*
* Excludes friends that are already in the group, and banned friends if the
* user is not a group admin.
*
* @since BuddyPress (1.0.0)
*
* @param int $user_id User ID whose friends to see can be invited. Default:
* ID of the logged-in user.
* @param int $group_id Group to check possible invitations against.
* @return mixed False if no friends, array of users if friends.
*/
function friends_get_friends_invite_list($user_id = 0, $group_id = 0)
{
// Default to logged in user id
if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}
// Only group admins can invited previously banned users
$user_is_admin = (bool) groups_is_user_admin($user_id, $group_id);
// Assume no friends
$friends = array();
// Default args
$args = apply_filters('bp_friends_pre_get_invite_list', array('user_id' => $user_id, 'type' => 'alphabetical', 'per_page' => 0));
// User has friends
if (bp_has_members($args)) {
/**
* Loop through all friends and try to add them to the invitation list.
*
* Exclude friends that:
* 1. are already members of the group
* 2. are banned from this group if the current user is also not a
* group admin.
*/
while (bp_members()) {
// Load the member
bp_the_member();
// Get the user ID of the friend
$friend_user_id = bp_get_member_user_id();
// Skip friend if already in the group
if (groups_is_user_member($friend_user_id, $group_id)) {
continue;
}
// Skip friend if not group admin and user banned from group
if (false === $user_is_admin && groups_is_user_banned($friend_user_id, $group_id)) {
continue;
}
// Friend is safe, so add it to the array of possible friends
$friends[] = array('id' => $friend_user_id, 'full_name' => bp_get_member_name());
}
}
// If no friends, explicitly set to false
if (empty($friends)) {
$friends = false;
}
// Allow friends to be filtered
return apply_filters('bp_friends_get_invite_list', $friends, $user_id, $group_id);
}
示例9: results
/**
* Display results
*/
public function results()
{
//Show/hide members with no location in the results. Default set to false
$this->show_non_located_users = apply_filters('show_users_without_location', false, $this->form);
//prevent BuddyPress from using its own "paged" value for the current page
if (!empty($_REQUEST['upage'])) {
unset($_REQUEST['upage']);
}
/*
$xp_ids = array();
//query the xprofile fields. This is done in a saperate function
if ( apply_filters( 'gmw_fl_do_xprofile_query', true ) ) {
$xprofile_users = gmw_fl_query_xprofile_fields( $this->form ,$_GET );
//if fields entered but no users returned abort the query
if ( $xprofile_users['status'] == 'no_ids_found' ) {
$xp_ids = 0;
//if users returned. add them to query
} elseif ( $xprofile_users['status'] == 'ids_found' ) {
$xp_ids = $xprofile_users['ids'];
}
}
*/
//query args
$this->form['query_args'] = apply_filters('gmw_fl_search_query_args', array('type' => 'distance', 'per_page' => $this->form['get_per_page'], 'page' => $this->form['paged']), $this->form);
//modify the form values before query
$this->form = apply_filters('gmw_fl_form_before_members_query', $this->form, $this->settings);
$this->form = apply_filters("gmw_fl_form_before_members_query_{$this->form['ID']}", $this->form, $this->settings);
//modify BP users query
add_action('bp_pre_user_query', array($this, 'gmwBpQuery'));
//modify WP User query
add_action('pre_user_query', array($this, 'gmwWpQuery'));
//enqueue stylesheet and get results template file
$results_template = $this->search_results();
if (bp_has_members($this->form['query_args'])) {
global $members_template;
$members_template = apply_filters('gmw_fl_members_before_members_loop', $members_template, $this->form, $this->settings);
//setup member count
$this->form['member_count'] = $this->form['paged'] == 1 ? 1 : $this->form['get_per_page'] * ($this->form['paged'] - 1) + 1;
$this->form['results'] = $members_template->members;
$this->form['total_results'] = $members_template->total_member_count;
$this->form['max_pages'] = $this->form['total_results'] / $this->form['get_per_page'];
echo '<div id="buddypress">';
//load results template file to display list of members
if (isset($this->form['search_results']['display_members']) && !$this->form['in_widget']) {
add_action('gmw_search_results_loop_item_start', array($this, 'modify_member'), 10);
$gmw = $this->form;
include $results_template;
/*
* if we do not display list of members we still need to have a loop
* and add some information to each members in order to be able to
* display it on the map
*/
} elseif ($this->form['search_results']['display_map'] != 'na') {
while (bp_members()) {
bp_the_member();
self::modify_member();
}
}
echo '</div>';
}
remove_action('bp_pre_user_query', array($this, 'gmwBpQuery'));
remove_action('pre_user_query', array($this, 'gmwWpQuery'));
}
示例10: widget
/**
* Display the Members widget.
*
* @since 1.0.3
*
* @see WP_Widget::widget() for description of parameters.
*
* @param array $args Widget arguments.
* @param array $instance Widget settings, as saved by the user.
*/
public function widget($args, $instance)
{
global $members_template;
// Get widget settings.
$settings = $this->parse_settings($instance);
/**
* Filters the title of the Members widget.
*
* @since 1.8.0
* @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
*
* @param string $title The widget title.
* @param array $settings The settings for the particular instance of the widget.
* @param string $id_base Root ID for all widgets of this type.
*/
$title = apply_filters('widget_title', $settings['title'], $settings, $this->id_base);
$title = $settings['link_title'] ? '<a href="' . bp_get_members_directory_permalink() . '">' . $title . '</a>' : $title;
/**
* Filters the separator of the member widget links.
*
* @since 2.4.0
*
* @param string $separator Separator string. Default '|'.
*/
$separator = apply_filters('bp_members_widget_separator', '|');
// Output before widget HTMl, title (and maybe content before & after it).
echo $args['before_widget'] . $args['before_title'] . $title . $args['after_title'];
// Setup args for querying members.
$members_args = array('user_id' => 0, 'type' => $settings['member_default'], 'per_page' => $settings['max_members'], 'max' => $settings['max_members'], 'populate_extras' => true, 'search_terms' => false);
// Back up the global.
$old_members_template = $members_template;
?>
<?php
if (bp_has_members($members_args)) {
?>
<div class="item-options" id="members-list-options">
<a href="<?php
bp_members_directory_permalink();
?>
" id="newest-members" <?php
if ('newest' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Newest', 'buddypress');
?>
</a>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_members_directory_permalink();
?>
" id="recently-active-members" <?php
if ('active' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Active', 'buddypress');
?>
</a>
<?php
if (bp_is_active('friends')) {
?>
<span class="bp-separator" role="separator"><?php
echo esc_html($separator);
?>
</span>
<a href="<?php
bp_members_directory_permalink();
?>
" id="popular-members" <?php
if ('popular' === $settings['member_default']) {
?>
class="selected"<?php
}
?>
><?php
esc_html_e('Popular', 'buddypress');
?>
</a>
//.........这里部分代码省略.........
示例11: do_action
* BuddyPress - Members Loop
*
* Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
*
* @package BuddyPress
* @subpackage bp-legacy
*/
global $bp, $members_template, $wpdb;
?>
<?php
do_action('bp_before_members_loop');
?>
<?php
if (bp_has_members(bp_ajax_querystring('members') . '&type=alphabetical&per_page=999')) {
?>
<?php
do_action('bp_before_directory_members_list');
?>
<ul id="members-list" class="item-list" role="main">
<?php
while (bp_members()) {
bp_the_member();
$groups = '';
$user_id = bp_get_member_user_id();
$group_ids = $wpdb->get_results("SELECT group_id FROM wp_bp_groups_members WHERE user_id={$user_id}");
foreach ($group_ids as $group) {
示例12: bp_core_ajax_widget_members
/**
* AJAX request handler for Members widgets.
*
* @since 1.0.0
*
* @see BP_Core_Members_Widget
*/
function bp_core_ajax_widget_members()
{
check_ajax_referer('bp_core_widget_members');
// Setup some variables to check.
$filter = !empty($_POST['filter']) ? $_POST['filter'] : 'recently-active-members';
$max_members = !empty($_POST['max-members']) ? absint($_POST['max-members']) : 5;
// Determine the type of members query to perform.
switch ($filter) {
// Newest activated.
case 'newest-members':
$type = 'newest';
break;
// Popular by friends.
// Popular by friends.
case 'popular-members':
if (bp_is_active('friends')) {
$type = 'popular';
} else {
$type = 'active';
}
break;
// Default.
// Default.
case 'recently-active-members':
default:
$type = 'active';
break;
}
// Setup args for querying members.
$members_args = array('user_id' => 0, 'type' => $type, 'per_page' => $max_members, 'max' => $max_members, 'populate_extras' => true, 'search_terms' => false);
// Query for members.
if (bp_has_members($members_args)) {
?>
<?php
echo '0[[SPLIT]]';
// Return valid result. TODO: remove this.
?>
<?php
while (bp_members()) {
bp_the_member();
?>
<li class="vcard">
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
"><?php
bp_member_avatar();
?>
</a>
</div>
<div class="item">
<div class="item-title fn"><a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
"><?php
bp_member_name();
?>
</a></div>
<?php
if ('active' === $type) {
?>
<div class="item-meta"><span class="activity"><?php
bp_member_last_active();
?>
</span></div>
<?php
} elseif ('newest' === $type) {
?>
<div class="item-meta"><span class="activity"><?php
bp_member_registered();
?>
</span></div>
<?php
} elseif (bp_is_active('friends')) {
?>
<div class="item-meta"><span class="activity"><?php
bp_member_total_friend_count();
?>
</span></div>
<?php
}
?>
</div>
</li>
<?php
}
?>
//.........这里部分代码省略.........
示例13: do_action
/**
* BuddyPress - Members Loop
*
* Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
*
* @package BuddyPress
* @subpackage bp-legacy
*/
?>
<?php
do_action('bp_before_members_loop');
?>
<?php
if (bp_has_members(bp_ajax_querystring('members') . '&per_page=' . sq_option('bp_members_perpage', 24))) {
?>
<div id="pag-top" class="pagination">
<div class="pag-count" id="member-dir-count-top">
<?php
bp_members_pagination_count();
?>
</div>
<div class="pagination-links" id="member-dir-pag-top">
<?php
示例14: buat_get_user_template
function buat_get_user_template($type)
{
$filtered_users = buat_gather_user_ids($type);
if (bp_has_members("include={$filtered_users}&type=alphabetical")) {
?>
<div class="pagination">
<div class="pag-count" id="member-dir-count">
<?php
bp_members_pagination_count();
?>
</div>
<div class="pagination-links" id="member-dir-pag">
<?php
bp_members_pagination_links();
?>
</div>
</div>
<?php
do_action('bp_before_directory_members_list');
?>
<ul id="members-list" class="item-list" style="list-style-type:none; margin: 0; width: auto">
<?php
while (bp_members()) {
bp_the_member();
?>
<li>
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
"><?php
bp_member_avatar();
?>
</a>
</div>
<div class="item">
<div class="item-title">
<a href="<?php
bp_member_permalink();
?>
"><?php
bp_member_name();
?>
</a>
<?php
if (bp_get_member_latest_update()) {
?>
<span class="update"> - <?php
bp_member_latest_update('length=10');
?>
</span>
<?php
}
?>
</div>
<div class="item-meta"><span class="activity"><?php
bp_member_last_active();
?>
</span></div>
<?php
do_action('bp_directory_members_item');
?>
<?php
/***
* If you want to show specific profile fields here you can,
* but it'll add an extra query for each member in the loop
* (only one regadless of the number of fields you show):
*
* bp_member_profile_data( 'field=the field name' );
*/
?>
</div>
<div class="action">
<?php
do_action('bp_directory_members_actions');
?>
</div>
<div class="clear"></div>
</li>
<?php
}
?>
</ul>
<?php
do_action('bp_after_directory_members_list');
?>
//.........这里部分代码省略.........
示例15: kleo_bp_member_stats
function kleo_bp_member_stats($field = false, $value = false, $online = false)
{
global $wpdb;
if (!$field || !$value) {
return;
}
$where = " WHERE name = '" . $field . "' AND value = '" . esc_sql($value) . "'";
$sql = "SELECT " . $wpdb->base_prefix . "bp_xprofile_data.user_id FROM " . $wpdb->base_prefix . "bp_xprofile_data\n\t\t\t\tJOIN " . $wpdb->base_prefix . "bp_xprofile_fields ON " . $wpdb->base_prefix . "bp_xprofile_data.field_id = " . $wpdb->base_prefix . "bp_xprofile_fields.id\n\t\t\t\t{$where}";
$match_ids = $wpdb->get_col($sql);
if (!$online) {
return count($match_ids);
}
if (!$match_ids) {
$match_ids = array(0);
}
if (!empty($match_ids)) {
$include_members = '&include=' . join(",", $match_ids);
} else {
$include_members = '';
}
$i = 0;
if (bp_has_members('user_id=0&type=online&per_page=999999999&populate_extras=0' . $include_members)) {
while (bp_members()) {
bp_the_member();
$i++;
}
}
return apply_filters('kleo_bp_member_stats', $i, $value);
}