本文整理汇总了PHP中bp_get_member_user_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_member_user_id函数的具体用法?PHP bp_get_member_user_id怎么用?PHP bp_get_member_user_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_member_user_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_follow_get_add_follow_button
/**
* Returns a follow / unfollow button for a given user depending on the follower status.
*
* Checks to see if the follower is already following the leader. If is following, returns
* "Stop following" button; if not following, returns "Follow" button.
*
* @param array $args {
* Array of arguments.
* @type int $leader_id The user ID of the person we want to follow.
* @type int $follower_id The user ID initiating the follow request.
* @type string $link_text The anchor text for the link.
* @type string $link_title The title attribute for the link.
* @type string $wrapper_class CSS class for the wrapper container.
* @type string $link_class CSS class for the link.
* @type string $wrapper The element for the wrapper container. Defaults to 'div'.
* }
* @return mixed String of the button on success. Boolean false on failure.
* @uses bp_get_button() Renders a button using the BP Button API
* @author r-a-y
* @since 1.1
*/
function bp_follow_get_add_follow_button($args = '')
{
global $bp, $members_template;
$r = wp_parse_args($args, array('leader_id' => bp_displayed_user_id(), 'follower_id' => bp_loggedin_user_id(), 'link_text' => '', 'link_title' => '', 'wrapper_class' => '', 'link_class' => '', 'wrapper' => 'div'));
if (!$r['leader_id'] || !$r['follower_id']) {
return false;
}
// if we're checking during a members loop, then follow status is already
// queried via bp_follow_inject_member_follow_status()
if (!empty($members_template->in_the_loop) && $r['follower_id'] == bp_loggedin_user_id() && $r['leader_id'] == bp_get_member_user_id()) {
$is_following = $members_template->member->is_following;
// else we manually query the follow status
} else {
$is_following = bp_follow_is_following(array('leader_id' => $r['leader_id'], 'follower_id' => $r['follower_id']));
}
// if the logged-in user is the leader, use already-queried variables
if (bp_loggedin_user_id() && $r['leader_id'] == bp_loggedin_user_id()) {
$leader_domain = bp_loggedin_user_domain();
$leader_fullname = bp_get_loggedin_user_fullname();
// else we do a lookup for the user domain and display name of the leader
} else {
$leader_domain = bp_core_get_user_domain($r['leader_id']);
$leader_fullname = bp_core_get_user_displayname($r['leader_id']);
}
// setup some variables
if ($is_following) {
$id = 'following';
$action = 'stop';
$class = 'unfollow';
$link_text = sprintf(_x('Unfollow', 'Button', 'bp-follow'), apply_filters('bp_follow_leader_name', bp_get_user_firstname($leader_fullname), $r['leader_id']));
if (empty($r['link_text'])) {
$r['link_text'] = $link_text;
}
} else {
$id = 'not-following';
$action = 'start';
$class = 'follow';
$link_text = sprintf(_x('Follow', 'Button', 'bp-follow'), apply_filters('bp_follow_leader_name', bp_get_user_firstname($leader_fullname), $r['leader_id']));
if (empty($r['link_text'])) {
$r['link_text'] = $link_text;
}
}
$wrapper_class = 'follow-button ' . $id;
if (!empty($r['wrapper_class'])) {
$wrapper_class .= ' ' . esc_attr($r['wrapper_class']);
}
$link_class = $class;
if (!empty($r['link_class'])) {
$link_class .= ' ' . esc_attr($r['link_class']);
}
// make sure we can view the button if a user is on their own page
$block_self = empty($members_template->member) ? true : false;
// if we're using AJAX and a user is on their own profile, we need to set
// block_self to false so the button shows up
if (bp_follow_is_doing_ajax() && bp_is_my_profile()) {
$block_self = false;
}
// setup the button arguments
$button = array('id' => $id, 'component' => 'follow', 'must_be_logged_in' => true, 'block_self' => $block_self, 'wrapper_class' => $wrapper_class, 'wrapper_id' => 'follow-button-' . (int) $r['leader_id'], 'link_href' => wp_nonce_url($leader_domain . $bp->follow->followers->slug . '/' . $action . '/', $action . '_following'), 'link_text' => esc_attr($r['link_text']), 'link_title' => esc_attr($r['link_title']), 'link_id' => $class . '-' . (int) $r['leader_id'], 'link_class' => $link_class, 'wrapper' => !empty($r['wrapper']) ? esc_attr($r['wrapper']) : false);
// Filter and return the HTML button
return bp_get_button(apply_filters('bp_follow_get_add_follow_button', $button, $r['leader_id'], $r['follower_id']));
}
示例2: test_friends_check_friendship_status_in_members_loop
/**
* @group friends_check_friendship_status
*/
public function test_friends_check_friendship_status_in_members_loop()
{
$now = time();
$u1 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now)));
$u2 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 100)));
$u3 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 200)));
$u4 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 300)));
$u5 = $this->factory->user->create(array('last_activity' => date('Y-m-d H:i:s', $now - 400)));
friends_add_friend($u1, $u2, true);
friends_add_friend($u1, $u3, false);
friends_add_friend($u4, $u1, false);
$old_user = get_current_user_id();
$this->set_current_user($u1);
$found = array();
if (bp_has_members()) {
while (bp_members()) {
bp_the_member();
$found[bp_get_member_user_id()] = friends_check_friendship_status($u1, bp_get_member_user_id());
}
}
$expected = array($u1 => 'not_friends', $u2 => 'is_friend', $u3 => 'pending', $u4 => 'awaiting_response', $u5 => 'not_friends');
$this->assertSame($expected, $found);
// clean up
$GLOBALS['members_template'] = null;
$this->set_current_user($old_user);
}
示例3: while
if (bp_has_members("include={$_POST['userid']}&max=1")) {
?>
<?php
while (bp_members()) {
bp_the_member();
global $members_template;
?>
<?php
/* The loop for the member you're showing a hovercard for is set up. Place hovercard code here */
?>
<div class="tipsy-avatar">
<img src="<?php
echo bp_core_fetch_avatar(array('item_id' => bp_get_member_user_id(), 'type' => 'full', 'width' => 100, 'height' => 100, 'html' => false));
?>
">
</div>
<div class='tipsy-content'>
<div class="user">
<h3>
<?php
// iexpert_skype_status( xprofile_get_field_data( 'skype', bp_get_member_user_id() ) );
?>
<a href="<?php
bp_member_link();
示例4: bp_member_user_id
/**
* Output the ID of the current member in the loop.
*
* @uses bp_get_member_user_id()
*/
function bp_member_user_id()
{
echo bp_get_member_user_id();
}
示例5: bp_member_name
bp_member_name();
?>
</a>
<span class="small">
<a href="<?php
bp_group_member_promote_admin_link(array('user_id' => bp_get_member_user_id()));
?>
" class="button confirm mod-promote-to-admin" title="<?php
_e('Promote to Admin', 'buddypress');
?>
"><?php
_e('Promote to Admin', 'buddypress');
?>
</a>
<a class="button confirm mod-demote-to-member" href="<?php
bp_group_member_demote_link(bp_get_member_user_id());
?>
"><?php
_e('Demote to Member', 'buddypress');
?>
</a>
</span>
</h5>
</li>
<?php
}
?>
</ul>
示例6: __construct
/**
* Builds the button based on class parameters:
*
* @since BuddyPress (1.2.6)
*
* @param array $args
* @return bool False if not allowed
*/
public function __construct($args = '')
{
$r = wp_parse_args($args, get_class_vars(__CLASS__));
// Required button properties
$this->id = $r['id'];
$this->component = $r['component'];
$this->must_be_logged_in = (bool) $r['must_be_logged_in'];
$this->block_self = (bool) $r['block_self'];
$this->wrapper = $r['wrapper'];
// $id and $component are required
if (empty($r['id']) || empty($r['component'])) {
return false;
}
// No button if component is not active
if (!bp_is_active($this->component)) {
return false;
}
// No button for guests if must be logged in
if (true == $this->must_be_logged_in && !is_user_logged_in()) {
return false;
}
// No button if viewing your own profile
if (true == $this->block_self && bp_is_my_profile()) {
return false;
}
// No button if you are the current user in a loop
if (true === $this->block_self && is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id()) {
return false;
}
// Wrapper properties
if (false !== $this->wrapper) {
// Wrapper ID
if (!empty($r['wrapper_id'])) {
$this->wrapper_id = ' id="' . $r['wrapper_id'] . '"';
}
// Wrapper class
if (!empty($r['wrapper_class'])) {
$this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"';
} else {
$this->wrapper_class = ' class="generic-button"';
}
// Set before and after
$before = '<' . $r['wrapper'] . $this->wrapper_class . $this->wrapper_id . '>';
$after = '</' . $r['wrapper'] . '>';
// No wrapper
} else {
$before = $after = '';
}
// Link properties
if (!empty($r['link_id'])) {
$this->link_id = ' id="' . $r['link_id'] . '"';
}
if (!empty($r['link_href'])) {
$this->link_href = ' href="' . $r['link_href'] . '"';
}
if (!empty($r['link_title'])) {
$this->link_title = ' title="' . $r['link_title'] . '"';
}
if (!empty($r['link_rel'])) {
$this->link_rel = ' rel="' . $r['link_rel'] . '"';
}
if (!empty($r['link_class'])) {
$this->link_class = ' class="' . $r['link_class'] . '"';
}
if (!empty($r['link_text'])) {
$this->link_text = $r['link_text'];
}
// Build the button
$this->contents = $before . '<a' . $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>' . $after;
// Allow button to be manipulated externally
$this->contents = apply_filters('bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after);
}
示例7: generate_html
protected function generate_html($template_type = '')
{
$group_ids = array();
foreach ($this->search_results['items'] as $item_id => $item) {
$group_ids[] = $item_id;
}
//now we have all the posts
//lets do a groups loop
if (bp_has_members(array('include' => $group_ids, 'per_page' => count($group_ids)))) {
while (bp_members()) {
bp_the_member();
$result_item = array('id' => bp_get_member_user_id(), 'type' => $this->type, 'title' => bp_get_member_name(), 'html' => buddyboss_global_search_buffer_template_part('loop/member', $template_type, false));
$this->search_results['items'][bp_get_member_user_id()] = $result_item;
}
}
}
示例8: bp_members_carousel_2
function bp_members_carousel_2($atts)
{
$output = '';
extract(shortcode_atts(array('type' => '', 'max_item' => 10, 'max_slides' => 7, 'min_slides' => 1, 'item_width' => 320, 'slide_margin' => 20), $atts));
$params = array('type' => $type, 'per_page' => $max_item);
if (function_exists('bp_has_members')) {
// begin bp members loop
if (bp_has_members($params)) {
ob_start();
$output .= '<ul data-slide-margin="' . $slide_margin . '"';
$output .= 'data-max-slides="' . $max_slides . '" data-min-slides="' . $min_slides . '"';
$output .= 'data-item-width="' . $item_width . '" class="gears-carousel-standard bp-members-carousel-2">';
while (bp_members()) {
bp_the_member();
?>
<li class="carousel-item gears-members-carousel-2-item">
<div class="gears-members-carousel-2-wrap">
<div class="cover-photo">
<?php
if (function_exists('bcp_get_cover_photo')) {
$args = array('size' => 'thumb', 'object_id' => bp_get_member_user_id());
$src = bcp_get_cover_photo($args);
echo '<img src="' . $src . '" alt="' . __('Cover Photo', 'gears') . '"/>';
}
?>
</div>
<div class="member-avatar">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
">
<?php
bp_member_avatar(array('type' => 'thumb'));
?>
</a>
</div>
<div class="member-name">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
">
<h3><?php
bp_member_name();
?>
</h3>
</a>
</div>
<div class="spacer"></div>
</div>
</li>
<?php
}
// end while
$output .= ob_get_clean();
$output .= '</ul>';
}
return $output;
} else {
return $this->bp_not_installed;
}
}
示例9: show_all_users_on_map
/**
* Shows all displayed users on a map.
*/
function show_all_users_on_map()
{
$member_ids = array();
$limit = apply_filters('agm_google_maps-bp_profile_map-user_limit', AGM_BP_PROFILE_MAP_USER_LIMIT);
$overrides = apply_filters('agm_google_maps-bp_profile_map-all_users_overrides', array());
// Get member ids
if (bp_has_members(array('per_page' => $limit))) {
while (bp_members()) {
bp_the_member();
$member_ids[] = bp_get_member_user_id();
}
}
bp_rewind_members();
echo $this->show_users_on_map($member_ids, $overrides);
}
示例10: _e
<span><?php
_e("Friend", "boss");
?>
</span>
<?php
}
?>
<?php
}
?>
<?php
if ($showing == "follows") {
?>
<span class="count"><?php
$followers = bp_follow_total_follow_counts(array("user_id" => bp_get_member_user_id()));
echo $followers["followers"];
?>
</span><span><?php
_e("Followers", "boss");
?>
</span>
<?php
}
?>
</div>
<div class="item-desc">
<p>
<?php
if (bp_get_member_latest_update()) {
示例11: list_friends
/**
* Outputs the list of friends (active or online)
*
* @package BP_Show_Friends_Widget
* @since 2.0
*
* @uses bp_is_user() to check we're on a user's profile
* @uses bp_displayed_user_id() to get displayed user id
* @uses bp_loggedin_user_id() to get loggedin user id
* @uses Widget->get_settings() to get the instance of the widget
* @uses the Members loop
*/
public function list_friends($limit = 0, $size = 0)
{
$user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
if (empty($limit) || empty($size)) {
$widget_settings = $this->get_settings();
$number = intval($_POST['bpsf_number']);
$limit = !empty($widget_settings[$number]['per_page']) ? $widget_settings[$number]['per_page'] : 5;
$size = !empty($widget_settings[$number]['size']) ? $widget_settings[$number]['size'] : 50;
}
// plugins or themes can now order the friends differently !
$args = apply_filters('bp_show_friends_args', array('user_id' => $user_id, 'type' => 'active', 'per_page' => $limit, 'max' => $limit, 'populate_extra' => 0));
$fallback_message = '<p>' . __('No friends!', 'bp-show-friends') . '</p>';
if (!empty($_POST['bpsf_type'])) {
$args['type'] = $_POST['bpsf_type'];
if ('online' == $args['type']) {
$fallback_message = '<p>' . __('No online friends!', 'bp-show-friends') . '</p>';
}
}
$avatar_args = apply_filters('bp_show_friends_avatar_args', array('type' => 'full', 'width' => $size, 'height' => $size, 'class' => 'avatar bp-show-friends'));
?>
<?php
if (empty($_POST['bpsf_type'])) {
?>
<div class="friends-container">
<?php
}
?>
<?php
if (bp_has_members($args)) {
?>
<ul class="bpsf-members">
<?php
while (bp_members()) {
bp_the_member();
?>
<li class="bpsf-member">
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
">
<?php
bp_member_avatar($avatar_args);
?>
</a>
</div>
<?php
do_action('bp_show_friends_after_friend_avatar', bp_get_member_user_id());
?>
</li>
<?php
}
?>
</ul>
<?php
} else {
echo $fallback_message;
}
if (empty($_POST['bpsf_type'])) {
?>
</div>
<br style="clear:both"/>
<?php
} else {
exit;
}
}
示例12: while
* Version 2.0
* 9-22-2014
*/
?>
<?php
// Group members
if (bp_is_group() && bp_group_has_members('exclude_admins_mods=0') || bp_has_members(bp_ajax_querystring('members'))) {
?>
<ul id="members-list" class="directory-list" role="main">
<?php
// Loop through all members
while (bp_members()) {
bp_the_member();
$user = new Apoc_User(bp_get_member_user_id(), 'directory', 60);
?>
<li class="member directory-entry">
<div class="directory-member reply-author">
<?php
echo $user->block;
?>
</div>
<div class="directory-content">
<header class="activity-header">
<p class="activity"><?php
bp_member_last_active();
?>
</p>
示例13: buatp_get_filtered_members
function buatp_get_filtered_members($return = 'exclude', $type_name = '', $query = '')
{
if (!$type_name) {
$type_name = buatp_current_page_type();
}
if (!$type_name && $return != 'all') {
return;
}
if (!$query) {
$query = 'type=alphabetical&per_page=false';
}
$users = (array) buatp_get_all_users_by_type($type_name);
if (bp_has_members($query)) {
while (bp_members()) {
bp_the_member();
$i++;
if (!in_array(bp_get_member_user_id(), $users)) {
$excludes[$i] = (int) bp_get_member_user_id();
} else {
$includes[$i] = (int) bp_get_member_user_id();
}
}
}
if ($return == 'exclude') {
return (array) $excludes;
} else {
if ($return == 'include') {
return (array) $includes;
} else {
return array_merge((array) $excludes, (array) $includes);
}
}
}
示例14: extract
extract(shortcode_atts(array('type' => 'newest', 'number' => 12, 'class' => '', 'rounded' => "rounded", 'online' => 'show'), $atts));
$params = array('type' => $type, 'per_page' => $number);
if ($rounded == 'rounded') {
$rounded = 'rounded';
}
if (function_exists('bp_is_active')) {
if (bp_has_members($params)) {
ob_start();
echo '<div class="wpb_wrapper">';
echo '<div id="members-dir-list" class="members dir-list">';
echo '<ul id="members-list" class="item-list row kleo-isotope masonry ' . $class . '">';
while (bp_members()) {
bp_the_member();
echo '<li class="kleo-masonry-item">' . '<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">' . '<div class="item-avatar ' . $rounded . '">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_avatar() . kleo_get_img_overlay() . '</a>';
if ($online == 'show') {
echo kleo_get_online_status(bp_get_member_user_id());
}
echo '</div>' . '<div class="item">
<div class="item-title">' . '<a href="' . bp_get_member_permalink() . '">' . bp_get_member_name() . '</a>
</div>
<div class="item-meta"><span class="activity">' . bp_get_member_last_active() . '</span></div>';
if (bp_get_member_latest_update()) {
echo '<span class="update"> ' . bp_get_member_latest_update() . '</span>';
}
do_action('bp_directory_members_item');
echo '</div>';
echo '<div class="action">';
do_action('bp_directory_members_actions');
echo '</div>';
echo '</div><!--end member-inner-list-->
</li>';
示例15: x_buddypress_members_loop_item_current_member_meta_link
function x_buddypress_members_loop_item_current_member_meta_link()
{
if (bp_loggedin_user_id() == bp_get_member_user_id()) {
?>
<a href="<?php
bp_member_permalink();
?>
"><?php
_e('Your Activity', '__x__');
?>
</a>
<?php
}
}