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


PHP BP_Core_User::get_newest_users方法代码示例

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


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

示例1: bp_core_ajax_widget_members

function bp_core_ajax_widget_members()
{
    global $bp;
    check_ajax_referer('bp_core_widget_members');
    switch ($_POST['filter']) {
        case 'newest-members':
            if (!($users = wp_cache_get('newest_users', 'bp'))) {
                $users = BP_Core_User::get_newest_users($_POST['max-members'], 1);
                wp_cache_set('newest_users', $users, 'bp');
            }
            break;
        case 'recently-active-members':
            if (!($users = wp_cache_get('active_users', 'bp'))) {
                $users = BP_Core_User::get_active_users($_POST['max-members'], 1);
                wp_cache_set('active_users', $users, 'bp');
            }
            break;
        case 'popular-members':
            if (!($users = wp_cache_get('popular_users', 'bp'))) {
                $users = BP_Core_User::get_popular_users($_POST['max-members'], 1);
                wp_cache_set('popular_users', $users, 'bp');
            }
            break;
    }
    if ($users['users']) {
        echo '0[[SPLIT]]';
        // return valid result.
        foreach ((array) $users['users'] as $user) {
            ?>
			<li class="vcard">
				<div class="item-avatar">
					<a href="<?php 
            echo bp_core_get_userlink($user->user_id, false, true);
            ?>
"><?php 
            echo bp_core_get_avatar($user->user_id, 1);
            ?>
</a>
				</div>

				<div class="item">
					<div class="item-title"><?php 
            echo bp_core_get_userlink($user->user_id);
            ?>
</div>
					<div class="item-meta">
						<span class="activity">
							<?php 
            if ('newest-members' == $_POST['filter']) {
                echo bp_core_get_last_activity($user->user_registered, __('registered %s ago', 'buddypress'));
            } else {
                if ('recently-active-members' == $_POST['filter']) {
                    echo bp_core_get_last_activity(get_usermeta($user->user_id, 'last_activity'), __('active %s ago', 'buddypress'));
                } else {
                    if ('popular-members' == $_POST['filter']) {
                        if (1 == get_usermeta($user->user_id, 'total_friend_count')) {
                            echo get_usermeta($user->user_id, 'total_friend_count') . __(' friend', 'buddypress');
                        } else {
                            echo get_usermeta($user->user_id, 'total_friend_count') . __(' friends', 'buddypress');
                        }
                    }
                }
            }
            ?>
						</span>
					</div>
				</div>
			</li>
			<?php 
        }
    } else {
        echo "-1[[SPLIT]]<li>" . __("No members matched the current filter.", 'buddypress');
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:74,代码来源:bp-core-ajax.php

示例2: 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' => '&laquo;', 'next_text' => '&raquo;', 'mid_size' => 1));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:51,代码来源:bp-core-templatetags.php

示例3: bp_core_widget_members

function bp_core_widget_members($args)
{
    global $current_blog, $bp;
    extract($args);
    $options = get_blog_option($current_blog->blog_id, 'bp_core_widget_members');
    ?>
	<?php 
    echo $before_widget;
    ?>
	<?php 
    echo $before_title . $widget_name . $after_title;
    ?>
	
	<?php 
    if (!($users = wp_cache_get('newest_users', 'bp'))) {
        $users = BP_Core_User::get_newest_users($options['max_members']);
        wp_cache_set('newest_users', $users, 'bp');
    }
    ?>
	
	<?php 
    if ($users['users']) {
        ?>
		<div class="item-options" id="members-list-options">
			<img id="ajax-loader-members" src="<?php 
        echo $bp->core->image_base;
        ?>
/ajax-loader.gif" height="7" alt="<?php 
        _e('Loading', 'buddypress');
        ?>
" style="display: none;" /> 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="newest-members" class="selected"><?php 
        _e('Newest', 'buddypress');
        ?>
</a> | 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="recently-active-members"><?php 
        _e('Active', 'buddypress');
        ?>
</a> | 
			<a href="<?php 
        echo site_url() . '/' . BP_MEMBERS_SLUG;
        ?>
" id="popular-members"><?php 
        _e('Popular', 'buddypress');
        ?>
</a>
		</div>
		<ul id="members-list" class="item-list">
			<?php 
        foreach ((array) $users['users'] as $user) {
            ?>
				<li class="vcard">
					<div class="item-avatar">
						<a href="<?php 
            echo bp_core_get_userlink($user->user_id, false, true);
            ?>
"><?php 
            echo bp_core_get_avatar($user->user_id, 1);
            ?>
</a>
					</div>

					<div class="item">
						<div class="item-title fn"><?php 
            echo bp_core_get_userlink($user->user_id);
            ?>
</div>
						<div class="item-meta"><span class="activity"><?php 
            echo bp_core_get_last_activity($user->user_registered, __('registered %s ago', 'buddypress'));
            ?>
</span></div>
					</div>
				</li>
				<?php 
            $counter++;
            ?>
	
			<?php 
        }
        ?>
		</ul>
		
		<?php 
        if (function_exists('wp_nonce_field')) {
            wp_nonce_field('bp_core_widget_members', '_wpnonce-members');
        }
        ?>
		
		<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php 
        echo attribute_escape($options['max_members']);
        ?>
" />
		
	<?php 
//.........这里部分代码省略.........
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:101,代码来源:bp-core-widgets.php


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