本文整理汇总了PHP中bp_get_member_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_member_name函数的具体用法?PHP bp_get_member_name怎么用?PHP bp_get_member_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_member_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/** @see WP_Widget::widget -- do not rename this */
function widget($args, $instance)
{
extract($args);
//Our variables from the widget settings.
$title = apply_filters('widget_title', $instance['title']);
$num = $instance['number'];
$activity = $instance['activity'];
$messages = $instance['messages'];
$friends = $instance['friends'];
if (!is_numeric($num)) {
$num = 5;
}
$user_id = bp_loggedin_user_id();
$width = $instance['width'];
echo '<div class="' . $width . '"><div class="dash-widget">' . $before_widget;
echo '<div id="vibe-tabs-student-activity" class="tabs tabbable">
<ul class="nav nav-tabs clearfix">';
if (isset($messages) && $messages && function_exists('messages_get_unread_count')) {
echo '<li><a href="#tab-messages" data-toggle="tab"><i class="icon-bubble-talk-1"></i>' . messages_get_unread_count($user_id) . '</a></li>';
}
if (isset($friends) && $friends) {
$searchArgs = array('type' => 'online', 'page' => 1, 'per_page' => $num, 'user_id' => $user_id);
if (bp_has_members($searchArgs)) {
while (bp_members()) {
bp_the_member();
$user_friends[] = array('avatar' => bp_get_member_avatar(), 'name' => bp_get_member_name(), 'last_active' => bp_get_member_last_active());
}
}
if (!is_array($user_friends)) {
$user_friends = array();
}
echo '<li><a href="#tab-friends" data-toggle="tab"><i class="icon-myspace-alt"></i>' . count($user_friends) . '</a></li>';
}
if (isset($activity) && $activity) {
echo '<li><a href="#tab-activity" data-toggle="tab"><i class="icon-atom"></i> </a></li>';
}
echo '</ul><div class="tab-content">';
// Display the widget title
global $wpdb, $bp;
if (isset($messages) && $messages) {
echo '<div id="tab-messages" class="tab-pane">
<h4>' . __('Unread Messages', 'wplms-dashboard') . '</h4>';
$message_args = array('user_id' => $user_id, 'box' => 'inbox', 'type' => 'unread', 'max' => $num);
if (bp_has_message_threads($message_args)) {
echo '<ul class="dash-unread-messages">';
while (bp_message_threads()) {
bp_message_thread();
echo '<li>' . bp_get_message_thread_avatar() . '<a href="' . bp_get_message_thread_view_link() . '">' . bp_get_message_thread_subject() . '<span>' . bp_get_message_thread_from() . '</span></a></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No messages found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($friends) && $friends) {
echo '<div id="tab-friends" class="tab-pane">
<h4>' . __('Friends Online', 'wplms-dashboard') . '</h4>';
if (count($user_friends)) {
echo '<ul class="dash-user-friends">';
foreach ($user_friends as $user_friend) {
echo '<li>' . $user_friend['avatar'] . ' ' . $user_friend['name'] . '<span>' . $user_friend['last_active'] . '</span></li>';
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No friends online', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
if (isset($activity) && $activity) {
$activities = apply_filters('wplms_dashboard_activity', $wpdb->get_results($wpdb->prepare("\n\t\t\tSELECT *\n\t\t FROM {$bp->activity->table_name} AS activity\n\t\t WHERE \tactivity.user_id IN (%d)\n\t\t AND (activity.action != '' OR activity.action IS NOT NULL)\n\t\t ORDER BY activity.date_recorded DESC\n\t\t LIMIT 0,{$num}\n\t\t", $user_id)));
echo '<div id="tab-activity" class="tab-pane student_activity">
<h4>' . __('Recent Activity', 'wplms-dashboard') . '</h4>';
if (isset($activities) && is_array($activities)) {
echo '<ul class="dash-activities">';
foreach ($activities as $activity) {
if (isset($activity->action) && $activity->action != '') {
$time = tofriendlytime(time() - strtotime($activity->date_recorded));
echo '<li class="' . $activity->component . ' ' . $activity->type . '">
<div class="dash-activity">
<span class="dash-activity-time">' . $time . ' ' . __('AGO', 'wplms-dashboard') . '</span>
<strong>' . $activity->action . '</strong>
</div>
</li>';
}
}
echo '</ul>';
} else {
echo '<div class="message error">' . __('No activity found', 'wplms-dashboard') . '</div>';
}
echo '</div>';
}
echo '</div></div>' . $after_widget . '</div></div>';
}
示例2: build_html
function build_html()
{
// Get the total member count
global $members_template;
$total = $members_template->total_member_count;
// Add everything to an array
$members = array();
while (bp_members()) {
bp_the_member();
$members[] = sprintf('<a href="%1$s" title="%2$s User Profile">%2$s</a>', bp_get_member_permalink(), bp_get_member_name());
}
if ($total > $this->number) {
$members[] = sprintf('<a href="%1$s" title="View all online members">%2$d More</a>', bp_get_members_directory_permalink(), $total - $this->number);
}
// Implode the members with separator
$members = implode(" | ", $members);
// Store everything in an output buffer
ob_start();
?>
<div id="sidebar-members-widget" class="widget">
<header class="widget-header">
<h3 class="widget-title">Online Members</h3>
</header>
<p class="online-members"><i class="fa fa-users"></i>
<?php
if ($total > 1) {
printf('There are currently <span class="activity-count">%d</span> members online:', $total);
} elseif ($total == 1) {
printf('There is currently <span class="activity-count">%d</span> member online:', $total);
} else {
echo 'There are currently no members online:';
}
?>
</p>
<p class="online-members"><?php
echo $members;
?>
</p>
</div><?php
// Get the contents of the buffer
$html = ob_get_contents();
ob_end_clean();
// Return the html to the class
return $html;
}
示例3: array
$params = array('type' => $type, 'per_page' => $number);
if ($perline != '') {
$class .= ' ' . $perline . '-thumbs';
}
if ($animation != '') {
$anim1 = ' animate-when-almost-visible';
$class .= ' kleo-thumbs-animated th-' . $animation;
}
if ($rounded == 'rounded') {
$class .= ' rounded';
}
if (function_exists('bp_is_active')) {
// begin bp members loop
if (bp_has_members($params)) {
$output .= '<div class="wpb_wrapper">';
$output .= '<div class="kleo-gallery' . $anim1 . '">';
$output .= '<div class="kleo-thumbs-images ' . $class . '">';
while (bp_members()) {
bp_the_member();
$output .= '<a href="' . bp_get_member_permalink() . '" title="' . bp_get_member_name() . '">';
$output .= bp_get_member_avatar(array('type' => 'full', 'width' => '250', 'height' => '250'));
$output .= kleo_get_img_overlay();
$output .= '</a>';
}
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
} else {
$output = __("This shortcode must have Buddypress installed to work.", "k-elements");
}
示例4: 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);
}
示例5: bp_member_name
/**
* Output display name of current member in the loop.
*/
function bp_member_name()
{
/**
* Filters the display name of current member in the loop.
*
* @since 1.2.0
*
* @param string $value Display name for current member.
*/
echo apply_filters('bp_member_name', bp_get_member_name());
}
示例6: _e
_e('Moderators', 'vibe');
?>
</h4>
<?php
if (bp_has_members('&include=' . bp_group_mod_ids())) {
?>
<ul id="mods-list" class="item-list single-line">
<?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' => sprintf(__('Profile picture of %s', 'vibe'), bp_get_member_name())));
?>
<h5>
<a href="<?php
bp_member_permalink();
?>
"> <?php
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"
示例7: bp_member_name
/**
* Echoes bp_get_member_name()
*
* @package BuddyPress
*/
function bp_member_name()
{
echo apply_filters('bp_member_name', bp_get_member_name());
}
示例8: 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;
}
}
}
示例9: 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 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();
/**
* Filters default arguments for list of friends a user can invite into this group.
*
* @since 1.5.4
*
* @param array $value Array of default parameters for invite list.
*/
$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;
}
/**
* Filters the list of potential friends that can be invited to this group.
*
* @since 1.5.4
*
* @param array|bool $friends Array friends available to invite or false for no friends.
* @param int $user_id ID of the user checked for who they can invite.
* @param int $group_id ID of the group being checked on.
*/
return apply_filters('bp_friends_get_invite_list', $friends, $user_id, $group_id);
}
示例10: while
?>
</h5>
<?php
if (bp_has_members('&include=' . bp_group_mod_ids())) {
?>
<ul id="mods-list" class="clearfix item-list bp-tt-fix-list single-line">
<?php
while (bp_members()) {
bp_the_member();
?>
<li class="col-md-6">
<div>
<?php
echo bp_core_fetch_avatar(array('item_id' => bp_get_member_user_id(), 'type' => 'full', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_member_name())));
?>
</div>
<div>
<h6><a href="<?php
bp_member_permalink();
?>
"> <?php
bp_member_name();
?>
</a></h6>
<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
示例11: extract
<?php
$output = '';
extract(shortcode_atts(array('type' => '', 'max_item' => 10, 'max_slides' => 7, 'min_slides' => 1, 'item_width' => 175), $atts));
$params = array('type' => $type, 'per_page' => $max_item);
if (function_exists('bp_has_members')) {
// begin bp members loop
if (bp_has_members($params)) {
$output .= '<div class="clearfix">';
$output .= '<ul data-max-slides="' . $max_slides . '" data-min-slides="' . $min_slides . '"
data-item-width="' . $item_width . '" class="gears-carousel-standard bp-members-carousel">';
while (bp_members()) {
bp_the_member();
$output .= '<li class="carousel-item">';
$name = bp_get_member_name();
$permalink = bp_get_member_permalink();
$last_active = bp_get_member_last_active();
$output .= '<a class="members-name" href="' . esc_url($permalink) . '" title="' . esc_attr($name) . '">';
$output .= esc_attr($name);
$output .= '</a>';
$output .= '<a href="' . esc_url($permalink) . '" title="' . esc_attr($name) . '">';
$output .= bp_get_member_avatar(array('type' => 'full'));
$output .= '</a>';
if (class_exists('BP_Follow')) {
if (method_exists('BP_Follow', 'get_counts')) {
$follow_count = BP_Follow::get_counts(bp_get_member_user_id());
$follow_label = $follow_count['followers'] == 1 ? 'Follower' : 'Followers';
$output .= '<p><strong>' . $follow_count['followers'] . ' ' . $follow_label . '</strong></p>';
}
}
$output .= '</li>';
示例12: friends_get_friends_invite_list
function friends_get_friends_invite_list($user_id = 0)
{
global $bp;
if (!$user_id) {
$user_id = bp_loggedin_user_id();
}
if (bp_has_members('user_id=' . $user_id . '&type=alphabetical&per_page=0')) {
while (bp_members()) {
bp_the_member();
$friends[] = array('id' => bp_get_member_user_id(), 'full_name' => bp_get_member_name());
}
}
if (empty($friends)) {
return false;
}
return $friends;
}
示例13: bp_members_list
/**
* BP Members List
*/
function bp_members_list($atts)
{
$output = '';
extract(shortcode_atts(array('type' => 'active', 'max_item' => 10), $atts));
// available columns are 1, 2, 3, and 4
$params = array('type' => $type, 'per_page' => $max_item);
if (function_exists('bp_has_members')) {
// begin bp members loop
if (bp_has_members($params)) {
$output .= '<div class="clearfix">';
$output .= '<ul class="gears-bp-members-list clear">';
while (bp_members()) {
$output .= '<li class="clearfix bp-members-list-item ">';
bp_the_member();
$output .= bp_get_member_avatar(array('type' => 'full', 'class' => 'col-md-3 col-xs-3 col-sm-3 trans avatar'));
$output .= '<div class="col-md-9 col-sm-9 col-xs-9">';
$output .= '<h5><a href="' . bp_get_member_permalink() . '" title="' . bp_get_member_name() . '">' . bp_get_member_name() . '</a></h5>';
$output .= '<div class="item-meta"><span class="small activity">' . bp_get_member_last_active() . '</span></div>';
do_action('bp_directory_members_item');
$output .= '</div>';
$output .= '</li>';
}
$output .= '</ul>';
$output .= '</div>';
return $output;
}
} else {
return $this->bp_not_installed;
}
}
示例14: ob_start
$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>';
}
echo '</ul>';
echo '</div>';
示例15: bp_member_permalink
bp_member_permalink();
?>
"><?php
bp_member_avatar($args = array('type' => 'full'));
?>
</a>
</div>
<div class="col-sm-8 col-md-8 item">
<div class="item-title">
<?php
$user_displayed_name_max = 18;
?>
<?php
$user_displayed_name = bp_get_member_name();
?>
<?php
$user_displayed_name_count = strlen($user_displayed_name);
?>
<?php
if ($user_displayed_name_count >= $user_displayed_name_max) {
?>
<h5><a class="tip" data-original-title="<?php
echo $user_displayed_name;
?>
" href="<?php
bp_member_permalink();
?>
"><?php
echo substr($user_displayed_name, 0, $user_displayed_name_max);