适用版本:Discuz! 4.0
HACK作者:HKLCF
最后更新:2005.12.15
修改文件:admin/misc.inc.php、forumdisplay.php
修改模版:forumdisplay
安装难易:易
技术支持:discuz.dismall.com
功能简述:4.0原始版本只能定制部分用户组(系统组、特殊组,且不包含游客)的子论坛在线列表显示,此hack可让你自定义所有可显示的用户组,甚至不同级别的普通会员也可以以不同的图标在子论坛在线列表中显示
修改步骤
1. 打开 admin/misc.inc.php 找(安装过在线列表显示所有用户组(含游客) For Discuz! 4.0不用做步骤1)
- $query = $db->query("SELECT groupid, grouptitle FROM {$tablepre}usergroups WHERE groupid<>'7' AND type<>'member'");
复制代码
改为
- $query = $db->query("SELECT groupid, grouptitle FROM {$tablepre}usergroups ORDER BY type");
复制代码
2. 打开 forumdisplay.php 找
- $whosonline = array();
- $forumname = strip_tags($forum['name']);
- $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM {$tablepre}sessions WHERE uid>'0' AND fid='$fid' AND invisible='0'");
- if($db->num_rows($query)) {
- $whosonlinestatus = 1;
- while($online = $db->fetch_array($query)) {
- $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0];
- $online['action'] = $actioncode[$online['action']];
- $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
- $whosonline[] = $online;
- }
- }
- unset($online);
- }
- } else {
- $whosonlinestatus = 0;
- }
复制代码
更改为
- $whosonline = array();
- $onlyuseronline = isset($_DCACHE['onlinelist'][7]) ? '' :"AND uid>'0'";
- $forumname = strip_tags($forum['name']);
- $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM {$tablepre}sessions WHERE fid='$fid' $onlyuseronline");
- if($db->num_rows($query)) {
- $whosonlinestatus = 1;
- while($online = $db->fetch_array($query)) {
- if ($online[uid]){
- $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0];
- }elseif(!$onlyuseronline){
- $online['icon'] = $_DCACHE['onlinelist'][7];
- $online['username'] = 'Guest';
- }else{
- continue;
- }
- $online['action'] = $actioncode[$online['action']];
- $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600));
- if ($online['invisible']) {
- $online['icon'] = 'online_invisible.gif';
- }
- if (!$online['invisible'] || $adminid == 1) {
- $whosonline[] = $online;
- }
- }
- }
- unset($online);
- }
- } else {
- $whosonlinestatus = 0;
- }
复制代码
3. 打开 forumdisplay 模板找(最后有空格的)
- <a href="viewpro.php?uid=$online[uid]"
复制代码
改为
- <!--{if $online[uid]}-->
- <a href="viewpro.php?uid=$online[uid]"
- <!--{else}-->
- <a href="###"
- <!--{/if}-->
复制代码
注:必须在后台的 “在线列表定制” 中设置了游客的图片,游客才会显示
~完成~
[ 本帖最后由 hklcf 于 2005-12-15 11:25 编辑 ] |