当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Core_User::get_online_users方法代码示例

本文整理汇总了PHP中BP_Core_User::get_online_users方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Core_User::get_online_users方法的具体用法?PHP BP_Core_User::get_online_users怎么用?PHP BP_Core_User::get_online_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Core_User的用法示例。


在下文中一共展示了BP_Core_User::get_online_users方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_core_members_template

 function bp_core_members_template($type, $per_page, $max)
 {
     global $bp, $bp_the_member_query;
     $this->pag_page = isset($_REQUEST['upage']) ? intval($_REQUEST['upage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     if (isset($_REQUEST['s']) && '' != $_REQUEST['s'] && $type != 'random') {
         $this->members = BP_Core_User::search_users($_REQUEST['s'], $this->pag_num, $this->pag_page);
     } else {
         if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
             $this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page);
         } else {
             switch ($type) {
                 case 'random':
                     $this->members = BP_Core_User::get_random_users($this->pag_num, $this->pag_page);
                     break;
                 case 'newest':
                     $this->members = BP_Core_User::get_newest_users($this->pag_num, $this->pag_page);
                     break;
                 case 'popular':
                     $this->members = BP_Core_User::get_popular_users($this->pag_num, $this->pag_page);
                     break;
                 case 'online':
                     $this->members = BP_Core_User::get_online_users($this->pag_num, $this->pag_page);
                     break;
                 case 'alphabetical':
                     $this->members = BP_Core_User::get_alphabetical_users($this->pag_num, $this->pag_page);
                     break;
                 case 'active':
                 default:
                     $this->members = BP_Core_User::get_active_users($this->pag_num, $this->pag_page);
                     break;
             }
         }
     }
     if (!$max) {
         $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);
     }
     $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));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:51,代码来源:bp-core-templatetags.php

示例2: bp_core_widget_whos_online

function bp_core_widget_whos_online($args)
{
    global $current_blog;
    extract($args);
    $options = get_blog_option($current_blog->blog_id, 'bp_core_widget_whos_online');
    ?>
	<?php 
    echo $before_widget;
    ?>
	<?php 
    echo $before_title . $widget_name . $after_title;
    ?>

	<?php 
    if (!($users = wp_cache_get('online_users', 'bp'))) {
        $users = BP_Core_User::get_online_users($options['max_members']);
        wp_cache_set('online_users', $users, 'bp');
    }
    ?>

	<?php 
    $users = BP_Core_User::get_online_users($options['max_members']);
    ?>

	<?php 
    if ($users['users']) {
        ?>
		<div class="avatar-block">
		<?php 
        foreach ((array) $users['users'] as $user) {
            ?>
			<div class="item-avatar">
				<a href="<?php 
            echo bp_core_get_userurl($user->user_id);
            ?>
" title="<?php 
            bp_fetch_user_fullname($user->user_id, true);
            ?>
"><?php 
            echo bp_core_get_avatar($user->user_id, 1);
            ?>
</a>
			</div>
		<?php 
        }
        ?>
		</div>
			
		<?php 
        if (function_exists('wp_nonce_field')) {
            wp_nonce_field('bp_core_widget_members', '_wpnonce-members');
        }
        ?>

		<input type="hidden" name="bp_core_widget_members_max" id="bp_core_widget_members_max" value="<?php 
        echo attribute_escape($options['max_members']);
        ?>
" />

	<?php 
    } else {
        ?>
		<div class="widget-error">
			<?php 
        _e('There are no users currently online.', 'buddypress');
        ?>
		</div>
	<?php 
    }
    ?>

	<?php 
    echo $after_widget;
    ?>
	
	<div class="clear" style="margin-bottom: 25px"></div>
	
<?php 
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:79,代码来源:bp-core-widgets.php


注:本文中的BP_Core_User::get_online_users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。