XiunoBBS 修罗论坛获取最新会员以及会员相关信息调用方法,可以在自己喜欢的地方获取最新会员信息!
XiunoBBS 修罗论坛获取最新会员的函数
<?ph
function get_site_user_order_by_gold($num=20){
//先获取用户列表
$userlist = db_find('user', array(), array('golds'=>2), 1, $num, 'uid');
foreach ($userlist as $user) {
echo '用户名:'.$user['username'].'积分:'.$user['credits'].'金币:'.$user['golds'].'<br/>';
}
}
function get_site_new_user($num=16){
//先获取用户列表
$userlist = cache_get('get_site_new_user');
if(empty($userlist)){
$userlist = db_find('user', array(), array('uid'=>-1), 1, $num, 'uid');
foreach ($userlist as &$user) {
$username = $user['username'];
xn_strlen($username)>4 && $username = xn_substr($username, 0, 4);
$user['dname'] = $username;
}
cache_set('get_site_new_user',$userlist,86400);//有效期1天
}
return $userlist;
}
?>
<?php
$nIndex = 0;
$userlist = get_site_new_user();
foreach ($userlist as $user) {
if(++$nIndex>16)break;
$user_avatarimg = 'view/img/avatar.png';
$user['avatar']!=0 && $user_avatarimg = $conf['upload_url'].'avatar/000/'.$user['uid'].'.png?'.$user['avatar'];
if($cdn_enable)$user_avatarimg = $theme_plugin['cdn_url'].$user_avatarimg;
?>
<div class="col-xs-4 text-center mb-3">
<a class="tt" href="<?php echo url("user-$user[uid]");?>" data-toggle="tooltip" title="<?php echo $user['dname'];?>">
<img src="<?php echo $user_avatarimg; ?>" alt="<?php echo $user['dname'];?>" width="39" height="39" class="img-circle"><br>
<?php echo $user['dname'];?>
</a>
</div>
<?php } ?
Xiunobbs会员相关信息调用方法
单独调用头像方 $v['uid'] 为循环中用户的id,单独调用,可以根据用户登录id $uid
下面是官方程序的一些用户信息标签,自行研究测试吧!
<?php $user = user_read_cache($v['uid'])?>
<?php echo $user['username']?> 会员名称
<?php echo $user['gid']?> 会员用户组
<?php echo $user['email']?> 注册邮箱
<?php echo $user['threads'];?> 发帖总数量
<?php echo $user['posts'];?> 回帖总数量
<?php echo $user['golds'];?> 会员金币数
<?php echo $user['credits'];?> 会员积分