本文整理汇总了PHP中bp_core_get_users函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_get_users函数的具体用法?PHP bp_core_get_users怎么用?PHP bp_core_get_users使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_get_users函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cacsp_paper_reader_selector
/**
* Generate the reader selector interface.
*/
function cacsp_paper_reader_selector($paper_id)
{
global $wpdb;
// Get a list of readers, friends, and co-group-members to prime selectbox.
// @todo Add AJAX support.
$paper = new CACSP_Paper($paper_id);
$paper_reader_ids = $paper->get_reader_ids();
$groups_of_user = cacsp_get_groups_of_user(bp_loggedin_user_id());
if (empty($groups_of_user)) {
$groups_of_user = array(0);
}
// So dirty.
$bp = buddypress();
$group_member_ids = $wpdb->get_col($wpdb->prepare("SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id IN (" . implode(',', $groups_of_user) . ") AND user_id != %d AND is_banned = 0 AND is_confirmed = 1", bp_loggedin_user_id()));
$group_member_ids = array_map('intval', $group_member_ids);
$friend_member_ids = array();
if (bp_is_active('friends')) {
$friend_member_ids = friends_get_friend_user_ids(bp_loggedin_user_id());
}
$users = bp_core_get_users(array('include' => array_merge($paper_reader_ids, $group_member_ids, $friend_member_ids), 'type' => 'alphabetical'));
$user_data = array();
$selected = array();
if (!empty($users['users'])) {
foreach ($users['users'] as $user) {
$user_id = (int) $user->ID;
$user_data[] = array('id' => $user_id, 'text' => html_entity_decode($user->display_name, ENT_QUOTES, 'UTF-8'));
// Collect data about the existing readers.
if (in_array($user_id, $paper_reader_ids, true)) {
$selected[] = array('id' => $user_id, 'text' => stripslashes($user->display_name));
}
}
}
$script = 'var CACSP_Potential_Readers = ' . wp_json_encode($user_data) . ';';
echo "\n" . '<script type="text/javascript">' . $script . '</script>' . "\n";
// Select2 only needs an <option> printed for the selected options.
?>
<select name="cacsp-readers[]" multiple="multiple" style="width:100%;" id="cacsp-reader-selector">
<?php
foreach ($selected as $_selected) {
echo '<option value="' . esc_attr($_selected['id']) . '" selected="selected">' . esc_html($_selected['text']) . '</option>';
}
?>
</select>
<?php
wp_nonce_field('cacsp-reader-selector', 'cacsp-reader-selector-nonce');
}
示例2: bp_core_members_template
function bp_core_members_template( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras ) {
global $bp;
$this->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
$this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
$this->type = $type;
if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
$this->members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras );
else
$this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
if ( !$max || $max >= (int)$this->members['total'] )
$this->total_member_count = (int)$this->members['total'];
else
$this->total_member_count = (int)$max;
$this->members = $this->members['users'];
if ( $max ) {
if ( $max >= count($this->members) ) {
$this->member_count = count( $this->members );
} else {
$this->member_count = (int)$max;
}
} else {
$this->member_count = count( $this->members );
}
if ( (int)$this->total_member_count && (int)$this->pag_num ) {
$this->pag_links = paginate_links( array(
'base' => add_query_arg( 'upage', '%#%' ),
'format' => '',
'total' => ceil( (int)$this->total_member_count / (int)$this->pag_num ),
'current' => (int)$this->pag_page,
'prev_text' => '←',
'next_text' => '→',
'mid_size' => 1
) );
}
}
示例3: kleo_ajax_search
function kleo_ajax_search()
{
//if "s" input is missing exit
if (empty($_REQUEST['s']) && empty($_REQUEST['bbp_search'])) {
die;
}
if (!empty($_REQUEST['bbp_search'])) {
$search_string = $_REQUEST['bbp_search'];
} else {
$search_string = $_REQUEST['s'];
}
$output = "";
$context = "any";
$defaults = array('numberposts' => 4, 'posts_per_page' => 20, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false, 's' => $_REQUEST['s']);
if (isset($_REQUEST['context']) && $_REQUEST['context'] != '') {
$context = explode(",", $_REQUEST['context']);
$defaults['post_type'] = $context;
}
$defaults = apply_filters('kleo_ajax_query_args', $defaults);
$the_query = new WP_Query($defaults);
$posts = $the_query->get_posts();
$members = array();
$members['total'] = 0;
$groups = array();
$groups['total'] = 0;
$forums = FALSE;
if (function_exists('bp_is_active') && ($context == "any" || in_array("members", $context))) {
$members = bp_core_get_users(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
}
if (function_exists('bp_is_active') && bp_is_active("groups") && ($context == "any" || in_array("groups", $context))) {
$groups = groups_get_groups(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
}
if (class_exists('bbPress') && ($context == "any" || in_array("forum", $context))) {
$forums = kleo_bbp_get_replies($search_string);
}
//if there are no posts, groups nor members
if (empty($posts) && $members['total'] == 0 && $groups['total'] == 0 && !$forums) {
$output = "<div class='kleo_ajax_entry ajax_not_found'>";
$output .= "<div class='ajax_search_content'>";
$output .= "<i class='icon icon-exclamation-sign'></i> ";
$output .= __("Sorry, we haven't found anything based on your criteria.", 'kleo_framework');
$output .= "<br>";
$output .= __("Please try searching by different terms.", 'kleo_framework');
$output .= "</div>";
$output .= "</div>";
echo $output;
die;
}
//if there are members
if ($members['total'] != 0) {
$output .= '<div class="kleo-ajax-part kleo-ajax-type-members">';
$output .= '<h4><span>' . __("Members", 'kleo_framework') . '</span></h4>';
foreach ((array) $members['users'] as $member) {
$image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $member->ID, 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
if ($update = bp_get_user_meta($member->ID, 'bp_latest_update', true)) {
$latest_activity = char_trim(trim(strip_tags(bp_create_excerpt($update['content'], 50, "..."))));
} else {
$latest_activity = '';
}
$output .= "<div class ='kleo_ajax_entry'>";
$output .= "<div class='ajax_search_image'>{$image}</div>";
$output .= "<div class='ajax_search_content'>";
$output .= "<a href='" . bp_core_get_user_domain($member->ID) . "' class='search_title'>";
$output .= $member->display_name;
$output .= "</a>";
$output .= "<span class='search_excerpt'>";
$output .= $latest_activity;
$output .= "</span>";
$output .= "</div>";
$output .= "</div>";
}
$output .= "<a class='ajax_view_all' href='" . bp_get_members_directory_permalink() . "?s=" . $search_string . "'>" . __('View member results', 'kleo_framework') . "</a>";
$output .= "</div>";
}
//if there are groups
if ($groups['total'] != 0) {
$output .= '<div class="kleo-ajax-part kleo-ajax-type-groups">';
$output .= '<h4><span>' . __("Groups", 'kleo_framework') . '</span></h4>';
foreach ((array) $groups['groups'] as $group) {
$image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $group->id, 'object' => 'group', 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
$output .= "<div class ='kleo_ajax_entry'>";
$output .= "<div class='ajax_search_image'>{$image}</div>";
$output .= "<div class='ajax_search_content'>";
$output .= "<a href='" . bp_get_group_permalink($group) . "' class='search_title'>";
$output .= $group->name;
$output .= "</a>";
$output .= "</div>";
$output .= "</div>";
}
$output .= "<a class='ajax_view_all' href='" . bp_get_groups_directory_permalink() . "?s=" . $search_string . "'>" . __('View group results', 'kleo_framework') . "</a>";
$output .= "</div>";
}
//if there are posts
if (!empty($posts)) {
$post_types = array();
$post_type_obj = array();
foreach ($posts as $post) {
$post_types[$post->post_type][] = $post;
if (empty($post_type_obj[$post->post_type])) {
$post_type_obj[$post->post_type] = get_post_type_object($post->post_type);
//.........这里部分代码省略.........
示例4: bp_core_get_random_member
/**
* Redirect to a random member page when visiting a ?random-member URL.
*
* @since BuddyPress (1.0.0)
*/
function bp_core_get_random_member()
{
if (!isset($_GET['random-member'])) {
return;
}
$user = bp_core_get_users(array('type' => 'random', 'per_page' => 1));
bp_core_redirect(bp_core_get_user_domain($user['users'][0]->id));
}
示例5: __construct
/**
* Constructor method.
*
* @see BP_User_Query for an in-depth description of parameters.
*
* @param string $type Sort order.
* @param int $page_number Page of results.
* @param int $per_page Number of results per page.
* @param int $max Max number of results to return.
* @param int $user_id Limit to friends of a user.
* @param string $search_terms Limit to users matching search terms.
* @param array $include Limit results by these user IDs.
* @param bool $populate_extras Fetch optional extras.
* @param array $exclude Exclude these IDs from results.
* @param array $meta_key Limit to users with a meta_key.
* @param array $meta_value Limit to users with a meta_value (with meta_key).
* @param string $page_arg Optional. The string used as a query parameter in pagination links.
* Default: 'upage'.
* @param array|string $member_type Array or comma-separated string of member types to limit results to.
* @param array|string $member_type__in Array or comma-separated string of member types to limit results to.
* @param array|string $member_type__not_in Array or comma-separated string of member types to exclude
* from results.
*/
function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage', $member_type = '', $member_type__in = '', $member_type__not_in = '')
{
$this->pag_arg = sanitize_key($page_arg);
$this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $page_number);
$this->pag_num = bp_sanitize_pagination_arg('num', $per_page);
$this->type = $type;
if (!empty($_REQUEST['letter'])) {
$this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
} else {
$this->members = bp_core_get_users(array('type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras, 'exclude' => $exclude, 'meta_key' => $meta_key, 'meta_value' => $meta_value, 'member_type' => $member_type, 'member_type__in' => $member_type__in, 'member_type__not_in' => $member_type__not_in));
}
if (!$max || $max >= (int) $this->members['total']) {
$this->total_member_count = (int) $this->members['total'];
} else {
$this->total_member_count = (int) $max;
}
$this->members = $this->members['users'];
if ($max) {
if ($max >= count($this->members)) {
$this->member_count = count($this->members);
} else {
$this->member_count = (int) $max;
}
} else {
$this->member_count = count($this->members);
}
if ((int) $this->total_member_count && (int) $this->pag_num) {
$pag_args = array($this->pag_arg => '%#%');
if (defined('DOING_AJAX') && true === (bool) DOING_AJAX) {
$base = remove_query_arg('s', wp_get_referer());
} else {
$base = '';
}
/**
* Defaults to an empty array to make sure paginate_links()
* won't add the $page_arg to the links which would break
* pagination in case JavaScript is disabled.
*/
$add_args = array();
if (!empty($search_terms)) {
$query_arg = bp_core_get_component_search_query_arg('members');
$add_args[$query_arg] = urlencode($search_terms);
}
$this->pag_links = paginate_links(array('base' => add_query_arg($pag_args, $base), 'format' => '', 'total' => ceil((int) $this->total_member_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('←', 'Member pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Member pagination next text', 'buddypress'), 'mid_size' => 1, 'add_args' => $add_args));
}
}
示例6: __construct
function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value)
{
global $bp;
$this->pag_page = !empty($_REQUEST['upage']) ? intval($_REQUEST['upage']) : (int) $page_number;
$this->pag_num = !empty($_REQUEST['num']) ? intval($_REQUEST['num']) : (int) $per_page;
$this->type = $type;
if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
$this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
} else {
if (false !== $include) {
$this->members = BP_Core_User::get_specific_users($include, $this->pag_num, $this->pag_page, $populate_extras);
} else {
$this->members = bp_core_get_users(array('type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras, 'exclude' => $exclude, 'meta_key' => $meta_key, 'meta_value' => $meta_value));
}
}
if (!$max || $max >= (int) $this->members['total']) {
$this->total_member_count = (int) $this->members['total'];
} else {
$this->total_member_count = (int) $max;
}
$this->members = $this->members['users'];
if ($max) {
if ($max >= count($this->members)) {
$this->member_count = count($this->members);
} else {
$this->member_count = (int) $max;
}
} else {
$this->member_count = count($this->members);
}
if ((int) $this->total_member_count && (int) $this->pag_num) {
$this->pag_links = paginate_links(array('base' => add_query_arg('upage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_member_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('←', 'Member pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Member pagination next text', 'buddypress'), 'mid_size' => 1));
}
}
示例7: test_bp_members_prefetch_member_type_array_cache_set
/**
* @group BP6193
*/
public function test_bp_members_prefetch_member_type_array_cache_set()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
bp_register_member_type('foo');
bp_register_member_type('bar');
bp_set_member_type($u1, 'foo');
bp_set_member_type($u1, 'bar', true);
// Get users so that the 'bp_user_query_populate_extras' is fired
// and members type prefetched
$users = bp_core_get_users(array('include' => array($u1, $u2)));
// Get single member type
$this->assertSame('foo', bp_get_member_type($u1, true));
$this->assertEmpty(bp_get_member_type($u2, true));
// Get all member types for the user
$this->assertEqualSets(array('foo', 'bar'), bp_get_member_type($u1, false));
$this->assertEmpty(bp_get_member_type($u2, false));
}
示例8: bp_groups_admin_autocomplete_handler
/**
* AJAX handler for group member autocomplete requests.
*
* @since BuddyPress (1.7.0)
*/
function bp_groups_admin_autocomplete_handler()
{
// Bail if user user shouldn't be here, or is a large network
if (!current_user_can('bp_moderate') || is_multisite() && wp_is_large_network('users')) {
wp_die(-1);
}
$return = array();
// Exclude current group members
$group_id = isset($_GET['group_id']) ? wp_parse_id_list($_GET['group_id']) : array();
$group_member_query = new BP_Group_Member_Query(array('group_id' => $group_id, 'per_page' => 0, 'group_role' => array('member', 'mod', 'admin'), 'populate_extras' => false, 'count_total' => false));
$group_members = !empty($group_member_query->results) ? wp_list_pluck($group_member_query->results, 'ID') : array();
$terms = isset($_GET['term']) ? $_GET['term'] : '';
$users = bp_core_get_users(array('type' => 'alphabetical', 'search_terms' => $terms, 'exclude' => $group_members, 'per_page' => 10, 'populate_extras' => false));
foreach ((array) $users['users'] as $user) {
$return[] = array('label' => sprintf(__('%1$s (%2$s)', 'buddypress'), bp_is_username_compatibility_mode() ? $user->user_login : $user->user_nicename, $user->user_email), 'value' => $user->user_nicename);
}
wp_die(json_encode($return));
}
示例9: __construct
/**
* Constructor method.
*
* @see BP_User_Query for an in-depth description of parameters.
*
* @param string $type Sort order.
* @param int $page_number Page of results.
* @param int $per_page Number of results per page.
* @param int $max Max number of results to return.
* @param int $user_id Limit to friends of a user.
* @param string $search_terms Limit to users matching search terms.
* @param array $include Limit results by these user IDs.
* @param bool $populate_extras Fetch optional extras.
* @param array $exclude Exclude these IDs from results.
* @param array $meta_key Limit to users with a meta_key.
* @param array $meta_value Limit to users with a meta_value (with meta_key).
* @param array $page_arg Optional. The string used as a query
* parameter in pagination links. Default: 'upage'.
*/
function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage')
{
$this->pag_page = !empty($_REQUEST[$page_arg]) ? intval($_REQUEST[$page_arg]) : (int) $page_number;
$this->pag_num = !empty($_REQUEST['num']) ? intval($_REQUEST['num']) : (int) $per_page;
$this->type = $type;
if (!empty($_REQUEST['letter'])) {
$this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
} else {
$this->members = bp_core_get_users(array('type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras, 'exclude' => $exclude, 'meta_key' => $meta_key, 'meta_value' => $meta_value));
}
if (!$max || $max >= (int) $this->members['total']) {
$this->total_member_count = (int) $this->members['total'];
} else {
$this->total_member_count = (int) $max;
}
$this->members = $this->members['users'];
if ($max) {
if ($max >= count($this->members)) {
$this->member_count = count($this->members);
} else {
$this->member_count = (int) $max;
}
} else {
$this->member_count = count($this->members);
}
if ((int) $this->total_member_count && (int) $this->pag_num) {
$pag_args = array($page_arg => '%#%');
if (defined('DOING_AJAX') && true === (bool) DOING_AJAX) {
$base = remove_query_arg('s', wp_get_referer());
} else {
$base = '';
}
if (!empty($search_terms)) {
$pag_args['s'] = $search_terms;
}
$this->pag_links = paginate_links(array('base' => add_query_arg($pag_args, $base), 'format' => '', 'total' => ceil((int) $this->total_member_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('←', 'Member pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Member pagination next text', 'buddypress'), 'mid_size' => 1));
}
}
示例10: rendez_vous_updated_notification
/**
* Send a screen notifications & email one when a rendez vous is updated
*
* Date set or report created
*
* @package Rendez Vous
* @subpackage Notifications
*
* @since Rendez Vous (1.0.0)
*/
function rendez_vous_updated_notification($id = 0, $args = array(), $notify = 0)
{
$bp = buddypress();
$rdv = rendez_vous();
if (empty($id) || empty($notify) || empty($rdv->item) || $id != $rdv->item->id || empty($args['message'])) {
return;
}
$has_updated = !empty($rdv->item->date_fixed) || !empty($rdv->item->report_created) ? true : false;
if (empty($has_updated) && empty($args['message'])) {
return;
}
// Only allow 1 message per day.
if (empty($has_updated) && 1 == get_transient('rendez_vous_last_message_' . $id)) {
return;
}
$rendez_vous = $rdv->item;
$attendees = $rendez_vous->attendees;
if (empty($attendees)) {
return;
}
// Remove the organizer
if (in_array($rendez_vous->organizer, $attendees)) {
$attendees = array_diff($attendees, array($rendez_vous->organizer));
}
$organizer_name = bp_core_get_user_displayname($rendez_vous->organizer);
$rendez_vous_link = rendez_vous_get_single_link($id, $rendez_vous->organizer);
$rendez_vous_content = stripslashes($rendez_vous->title);
$rdv_updated_action = false;
$component_action = false;
if (!empty($rdv->item->date_fixed)) {
if (is_numeric($rdv->item->date_fixed)) {
$rendez_vous_content .= "\n\n" . sprintf(__('Date fixed to %1$s at %2$s', 'rendez-vous'), date_i18n(get_option('date_format'), $rdv->item->date_fixed), date_i18n(get_option('time_format'), $rdv->item->date_fixed));
$rendez_vous_content .= "\n\n" . sprintf(__('Download the Calendar file %s', 'rendez-vous'), rendez_vous_get_ical_link($id, $rendez_vous->organizer));
} else {
$rendez_vous_content .= "\n\n" . sprintf(__('Date fixed to %s', 'rendez-vous'), esc_html($rdv->item->date_fixed));
}
$rdv_updated_action = __('fixed the date', 'rendez-vous');
$component_action = 'rendez_vous_fixed';
} else {
if (!empty($rdv->item->report_created)) {
$rdv_updated_action = __('created the report', 'rendez-vous');
$component_action = 'rendez_vous_report';
} else {
if (!empty($args['message'])) {
$rdv_updated_action = __('sent a message', 'rendez-vous');
$component_action = 'rendez_vous_message';
set_transient('rendez_vous_last_message_' . $id, 1, 24 * HOUR_IN_SECONDS);
}
}
}
$organizer_name = stripslashes($organizer_name);
// Append the custom message, if any
if (!empty($args['message'])) {
$rendez_vous_content .= "\n\n" . $args['message'];
}
$rendez_vous_content = wp_kses($rendez_vous_content, array());
$message = sprintf(__("%s %s for the rendez-vous: %s\n\nTo view details, log in and visit: %s\n\n---------------------\n", 'rendez-vous'), $organizer_name, $rdv_updated_action, $rendez_vous_content, esc_url($rendez_vous_link));
$subject = bp_get_email_subject(array('text' => sprintf(__('%s updated a rendez-vous', 'rendez-vous'), $organizer_name)));
// This way we'll have all needed users data at one and we will avoid spam users
$users = bp_core_get_users(array('type' => 'alphabetical', 'include' => implode(',', $attendees)));
foreach ($users['users'] as $attendee) {
$mail_content = $message;
if ('rendez_vous_message' != $component_action) {
// Screen Notification
bp_notifications_add_notification(array('user_id' => $attendee->ID, 'item_id' => $id, 'secondary_item_id' => $rendez_vous->organizer, 'component_name' => $bp->rendez_vous->id, 'component_action' => $component_action));
}
// Sending Emails
if ('no' == get_user_meta($attendee->ID, 'notification_rendez_vous_attend', true)) {
continue;
}
$user_settings = false;
$user_fullname = !empty($attendee->fullname) ? $attendee->fullname : $attendee->display_name;
$user_profile = bp_core_get_user_domain($attendee->ID, $attendee->user_nicename, $attendee->user_login);
$user_email = $attendee->user_email;
// Set up and send the message
$to = $attendee->user_email;
// Only show the disable notifications line if the settings component is enabled
if (bp_is_active('settings')) {
$user_settings = trailingslashit($user_profile . bp_get_settings_slug() . '/notifications');
$mail_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'rendez-vous'), esc_url($user_settings));
}
/* Send the message */
$to = apply_filters('rendez_vous_updated_notify_attendee', $to);
$subject = apply_filters('rendez_vous_updated_notify_subject', $subject, $organizer_name);
$mail_content = apply_filters('rendez_vous_updated_notify_message', $mail_content, $rendez_vous, $organizer_name, $rendez_vous_content, $rendez_vous_link, $user_settings);
wp_mail($to, $subject, $mail_content);
}
}
示例11: buddyboss_wall_prepare_user_likes
/**
* Retrieve user information from liked activity items
* all at once
*
* @since BuddyBoss 3.1.4
*/
function buddyboss_wall_prepare_user_likes($activities_template)
{
global $buddyboss_wall, $wpdb;
$activities = array();
$activity_ids = array();
$user_result = array();
$users = array();
$likes_to_users = array();
// We don't want the logged in user
$loggedin_user_id = intval(bp_loggedin_user_id());
if (!empty($activities_template->activities) && is_array($activities_template->activities)) {
$activities = $activities_template->activities;
}
foreach ($activities as $activity) {
if (!empty($activity->id) && intval($activity->id) > 0) {
$activity_ids[] = intval($activity->id);
}
}
if (!empty($activity_ids)) {
$sql = "SELECT user_id,meta_value FROM {$wpdb->base_prefix}usermeta\n\t\t\t\t\t\tWHERE meta_key = 'bp_favorite_activities'\n\t\t\t\t\t\tAND user_id != {$loggedin_user_id}\n\t\t\t\t\t\tAND (";
$sql .= ' meta_value LIKE "%' . implode('%" OR meta_value LIKE "%', $activity_ids) . '%" )';
$query = $wpdb->get_results($sql);
$user_ids = array();
// var_dump( $query );
// Add user IDs to array for USer Query below and store likes
if (!empty($query)) {
foreach ($query as $result) {
$user_ids[] = $result->user_id;
$user_likes = maybe_unserialize($result->meta_value);
// Make sure all activity IDs are integers
if (!empty($user_likes) && is_array($user_likes)) {
$users[$result->user_id]['likes'] = array_map('intval', $user_likes);
} else {
$users[$result->user_id]['likes'] = array();
}
}
}
// Get users tha have liked activities in this loop
if (!empty($user_ids)) {
$user_query = bp_core_get_users(array('include' => $user_ids));
if (!empty($user_query['users'])) {
$user_result = $user_query['users'];
}
}
}
// Add profile links and display names
foreach ($user_result as $user) {
$users[$user->ID]['profile'] = bp_core_get_user_domain($user->ID);
$users[$user->ID]['name'] = $user->display_name;
}
$like_activity_ids = array();
foreach ($users as $user_id => $user_data) {
$liked_activities = $user_data['likes'];
foreach ($liked_activities as $liked_activity_id) {
if (empty($likes_to_users[$liked_activity_id]) || !in_array($user_id, $likes_to_users[$liked_activity_id])) {
$likes_to_users[$liked_activity_id][] = $user_id;
}
}
}
$buddyboss_wall->like_users = $users;
$buddyboss_wall->likes_to_users = $likes_to_users;
// var_dump( $likes_to_users, $users );
}
示例12: _load_buddypress_profile_items
/**
* Loads BuddyPress profile items.
*/
private function _load_buddypress_profile_items()
{
global $wds_options;
if (!defined('BP_VERSION')) {
return false;
}
// Nothing to do
if (!(int) @$wds_options['sitemap-buddypress-profiles']) {
return false;
}
// Nothing to do
$users = bp_core_get_users(array('per_page' => WDS_BP_PROFILES_LIMIT));
$users = @$users['users'] ? $users['users'] : array();
foreach ($users as $user) {
$wp_user = new WP_User($user->id);
$role = @$wp_user->roles[0];
if (@$wds_options["exclude-profile-role-{$role}"]) {
continue;
}
$link = bp_core_get_user_domain($user->id);
$this->_add_item($link, 0.2, 'weekly', strtotime($user->last_activity), $user->display_name);
}
}
示例13: get_members
/**
* Returns an object with all members
* @return Object Members
*/
public function get_members()
{
/* Possible parameters:
* int limit: number of entries per page (default 20)
* int userid: userID to filter on(default unset)
* String type: action to filter on e.g. active, newest, alphabetical (default active)
*/
$oReturn = new stdClass();
$this->initVars('member');
if (!bp_has_members()) {
return $this->error('member');
}
$aParams['type'] = $this->type;
$aParams['include'] = $this->userid;
$aParams['per_page'] = $this->limit;
$mTempMembers = bp_core_get_users($aParams);
if (!empty($mTempMembers['users'])) {
$oReturn->users[0] = $mTempMembers['users'];
} else {
return $this->error('member');
}
return $oReturn;
}