本文整理汇总了PHP中bp_get_member_last_active函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_member_last_active函数的具体用法?PHP bp_get_member_last_active怎么用?PHP bp_get_member_last_active使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_member_last_active函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: bp_member_last_active
/**
* Output the current member's last active time.
*
* @param array $args See {@link bp_get_member_last_active()}.
*/
function bp_member_last_active($args = array())
{
echo bp_get_member_last_active($args);
}
示例3: bp_member_last_active
function bp_member_last_active()
{
echo bp_get_member_last_active();
}
示例4: widget
//.........这里部分代码省略.........
<?php
while (bp_members()) {
bp_the_member();
?>
<li class="vcard">
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
"><?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>
<div class="item-meta">
<?php
if ('newest' == $settings['member_default']) {
?>
<span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_registered(array('relative' => false)));
?>
"><?php
bp_member_registered();
?>
</span>
<?php
} elseif ('active' == $settings['member_default']) {
?>
<span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false)));
?>
"><?php
bp_member_last_active();
?>
</span>
<?php
} else {
?>
<span class="activity"><?php
bp_member_total_friend_count();
?>
</span>
<?php
}
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
wp_nonce_field('bp_core_widget_members', '_wpnonce-members', false);
?>
<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php
echo esc_attr($settings['max_members']);
?>
" />
<?php
} else {
?>
<div class="widget-error">
<?php
esc_html_e('No one has signed up yet!', 'buddypress');
?>
</div>
<?php
}
?>
<?php
echo $args['after_widget'];
// Restore the global.
$members_template = $old_members_template;
}
示例5: extract
$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>';
}
示例6: widget
//.........这里部分代码省略.........
?>
</a>
</div>
<ul id="friends-list" class="item-list">
<?php
while (bp_members()) {
bp_the_member();
?>
<li class="vcard">
<div class="item-avatar">
<a href="<?php
bp_member_permalink();
?>
" title="<?php
bp_member_name();
?>
"><?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>
<div class="item-meta">
<?php
if ('newest' == $instance['friend_default']) {
?>
<span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_registered(array('relative' => false)));
?>
"><?php
bp_member_registered();
?>
</span>
<?php
} elseif ('active' == $instance['friend_default']) {
?>
<span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false)));
?>
"><?php
bp_member_last_active();
?>
</span>
<?php
} else {
?>
<span class="activity"><?php
bp_member_total_friend_count();
?>
</span>
<?php
}
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
wp_nonce_field('bp_core_widget_friends', '_wpnonce-friends');
?>
<input type="hidden" name="friends_widget_max" id="friends_widget_max" value="<?php
echo absint($instance['max_friends']);
?>
" />
<?php
} else {
?>
<div class="widget-error">
<?php
_e('Sorry, no members were found.', 'buddypress');
?>
</div>
<?php
}
?>
<?php
echo $after_widget;
// Restore the global.
$members_template = $old_members_template;
}
示例7: bp_core_ajax_widget_friends
/**
* Process AJAX pagination or filtering for the Friends widget.
*
* @since 1.9.0
*/
function bp_core_ajax_widget_friends()
{
check_ajax_referer('bp_core_widget_friends');
switch ($_POST['filter']) {
case 'newest-friends':
$type = 'newest';
break;
case 'recently-active-friends':
$type = 'active';
break;
case 'popular-friends':
$type = 'popular';
break;
}
$members_args = array('user_id' => bp_displayed_user_id(), 'type' => $type, 'max' => absint($_POST['max-friends']), 'populate_extras' => 1);
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" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false)));
?>
"><?php
bp_member_last_active();
?>
</span></div>
<?php
} elseif ('newest' == $type) {
?>
<div class="item-meta"><span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_registered(array('relative' => false)));
?>
"><?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
}
?>
<?php
} else {
?>
<?php
echo "-1[[SPLIT]]<li>";
?>
<?php
_e('There were no members found, please try another filter.', 'buddypress');
?>
<?php
echo "</li>";
?>
//.........这里部分代码省略.........
示例8: test_bp_get_member_last_active_active_format_false
/**
* @group bp_get_member_last_active
*/
public function test_bp_get_member_last_active_active_format_false()
{
// Fake the global
global $members_template;
$time = date('Y-m-d H:i:s', time() - 24 * 60 * 60);
$members_template = new stdClass();
$members_template->member = new stdClass();
$members_template->member->last_activity = $time;
$this->assertEquals(bp_core_time_since($time), bp_get_member_last_active(array('active_format' => false)));
}
示例9: 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;
}
}
示例10: ob_start
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>';
echo '</div>';
$output = ob_get_clean();
示例11: bp_member_latest_update
if (bp_get_member_latest_update()) {
?>
<span class="update"> <?php
bp_member_latest_update();
?>
</span>
<?php
}
?>
</div>
<div class="item-meta"><span class="activity" data-livestamp="<?php
bp_core_iso8601_date(bp_get_member_last_active(array('relative' => false)));
?>
"><?php
bp_member_last_active();
?>
</span></div>
<?php
/**
* Fires inside the display of a directory member item.
*
* @since 1.1.0
*/
do_action('bp_directory_members_item');
?>