xiunobbs 网站右侧显示最新会员插件 开发探讨 PHP


看到使用XiunoBBS的站长朋友们需要这个功能,于是我寻思也写一个。

实现的方式非常简单...其实就是使用xiunobbs内置的函数罢了,然后展现数据

我们只需要建立一个index_site_brief_after.htm的hook点,然后写入如下代码即可

(PS:要显示多少用户就把$pagesize改一下,咱这里是显示最新12个)

<div class="card card-newuser">
    <div class="card-header text-grey">最新会员</div>
    <div class="card-body small">
        <div class="row">
            <?php
                $latest_users = user_find(array(),array('create_date'=>-1),$page = 1 , $pagesize = 12);
            ?>
            <?php foreach($latest_users as $latest_user){ ?>
            <div class="col-3 mb-1 text-center">
                <a class="small text-muted text-nowrap" href="<?php echo url("user-$latest_user[uid]");?>" data-toggle="tooltip" title="<?php echo $latest_user['username'];?>" data-original-title="<?php echo $latest_user['username'];?>">
                    <img src="<?php echo $latest_user['avatar_url']; ?>" alt="<?php echo $latest_user['username'];?>" width="28" height="28" class="img-circle"><br><?php echo mb_substr($latest_user['username'],0,3,'utf-8').'...';?>
                </a>
            </div>
            <?php } ?>
        </div>
    </div>
</div>


本站的的效果....(由于新注册的会员都没有更改头像...都还是默认头像...所以比较丑啦...)


插件自己在附件下载吧(登录可下载...拒绝伸手党

最后于 8天前 被夜琉璃编辑 ,原因: 修复了用户名过长的瑕疵...请重新下载插件
上传的附件:
签名:上善若水,水善利万物而不争,处众人之所恶,故几于道。
最新回复 (0)
    • 代码信条-CodeCreed
      2
        立即登录 立即注册 QQ登录
返回

Processed Time:0.13664889335632

  • 0.0002 SELECT * FROM bbs_session WHERE `sid`='cau4rquv6tkgoo8l0eg60vgqnq' LIMIT 1
  • 0.0002 SELECT * FROM bbs_cache WHERE `k`='bbs_grouplist' LIMIT 1
  • 0.0002 SELECT * FROM bbs_cache WHERE `k`='bbs_forumlist' LIMIT 1
  • 0.0001 SELECT * FROM bbs_cache WHERE `k`='bbs_runtime' LIMIT 1
  • 0.0001 SELECT * FROM bbs_cache WHERE `k`='bbs_setting' LIMIT 1
  • 0.0001 SELECT * FROM bbs_kv WHERE `k`='setting' LIMIT 1
  • 0.0001 SELECT * FROM bbs_thread WHERE `tid`=42 LIMIT 1
  • 0.0001 SELECT * FROM bbs_user WHERE `uid`=1 LIMIT 1
  • 0.0002 SELECT * FROM bbs_post WHERE `tid`=42 ORDER BY `pid` ASC LIMIT 0,100
  • 0.0001 SELECT * FROM bbs_thread WHERE `tid`='42' LIMIT 1
  • 0.0002 SELECT * FROM bbs_attach WHERE `pid`='51' LIMIT 0,1000
  • 0.0001 SELECT * FROM bbs_kv WHERE `k`='mobile_setting' LIMIT 1
  • [0.0002]UPDATE LOW_PRIORITY `bbs_thread` SET views=views+1 WHERE tid='42'
  • 0.0003 SELECT * FROM bbs_kv WHERE `k`='my_sign' LIMIT 1
  • 0.0004 SELECT * FROM bbs_git_tags_thread WHERE `tid`=42 LIMIT 0,12
  • 0.0002 SELECT * FROM bbs_git_tags WHERE (`tagid`='6' OR `tagid`='5' OR `tagid`='8') LIMIT 0,12
  • 0.0001 SELECT * FROM bbs_haya_favorite WHERE `uid`='' AND `tid`=42 LIMIT 0,10
  • 0.0001 SELECT * FROM bbs_cache WHERE `k`='bbs_tagCloud' LIMIT 1
  • 0.0002 SELECT * FROM bbs_thread WHERE `uid`='1' ORDER BY `lastpid` DESC LIMIT 0,6
_REQUEST:
Array
(
    [thread-42_htm] => 
    [0] => thread
    [1] => 42
)
_SESSION:
Array
(
    [fid] => 1
)
首页
开发
源码
运维
我的