Những thành viên đã truy cập trong X giờ qua cho Discuz (phiên bản cố định !!)

Tác giảyugiohhh 
Phiên bản Discuz đã thử nghiệm7.2 
Hỗ trợ phiên bản Discuz7.x 

Điều này thêm một hiển thị đơn giản của tất cả các thành viên đã truy cập diễn đàn trong X * giờ qua.

  • Tùy chọn (bạn có thể chỉnh sửa trong Vùng cấu hình)
    Cập nhật mới: Đã sửa lỗi biểu tượng thành viên khi bật biểu tượng Khách:
Demo

Bạn chỉ cần thay thế mã cũ bằng mã mới ở Bước 1

Bước 1: Mở include / index_classics.inc.php hoặc index.php (Discuz 7.0) (phiên bản cố định)

Tìm:

include template('discuz');

Thêm ở trên (Có một số cài đặt cấu hình bạn có thể chỉnh sửa trong Vùng cấu hình):

// Start - yugiohhh's Members who have visited in the last X hours - dz.yugiohhh.com
// Start - Config zone (option)
$yu_lasthours = 24; //last x hours
$yu_maxlastxlist = 1000; // limit number of members listed
$yu_boxtitle = 'Members who have visited in the last '.$yu_lasthours.' hours'; // title of visited box
// End - Config zone (option)


$yu_k = time() - ($yu_lasthours * 3600);
$yu_wholastx = array();
$yu_query = $db->query("SELECT s.uid, s.username, s.groupid, s.lastactivity, u.groupid, u.color FROM {$tablepre}members AS s, {$tablepre}usergroups AS u WHERE lastactivity >= ".$yu_k." AND s.groupid=u.groupid ORDER BY lastactivity DESC LIMIT ".$yu_maxlastxlist);
while($yu_lastx = $db->fetch_array($yu_query)) {
$yu_membercount ++;
$yu_lastx['num'] = $yu_membercount;
$yu_lastx['icon'] = isset($_DCACHE['onlinelist'][$yu_lastx['groupid']]) ? $_DCACHE['onlinelist'][$yu_lastx['groupid']] : $_DCACHE['onlinelist'][0];
$yu_lastx['lastactivity'] = gmdate("$dateformat $timeformat", $yu_lastx['lastactivity'] + ($timeoffset * 3600));
$yu_wholastx[] = $yu_lastx;
}
// End - yugiohhh's Members who have visited in the last X hours

Bước 2: Mở discuz.htm các mẫu của bạn

Tìm thấy:

$pluginhooks[index_bottom]

Thêm ở trên:

<!-- Start - yugiohhh's Members who have visited in the last X hours - dz.yugiohhh.com --> <div class="mainbox list" id="online"> <span class="headactions"><img id="forumlinks_img" src="{IMGDIR}/$collapseimg[forumlinks].gif" alt="" onclick="toggle_collapse('yu_lasxlist');" /></span> <h3><strong><a href="http://dz.yugiohhh.com">$yu_boxtitle ({$yu_membercount})</a></strong></h3> <dl id="yu_lasxlist" style="padding: 1em; border-top: 1px solid {COMMONBORDER};"> <dd> <!--{if $yu_wholastx}--> <!--{loop $yu_wholastx $key $yu_lastx}--> <!--{if $yu_lastx['uid']}--> <a href="space.php?uid=$yu_lastx[uid]" target="_blank" title="{lang time}: $yu_lastx[lastactivity]{LF}"><img src="images/common/$yu_lastx['icon']" border="none"/> <font color=$yu_lastx[color]>$yu_lastx[username]</font></a><!--{if $yu_lastx['num'] < $yu_membercount}-->, <!--{/if}--> <!--{else}--> $yu_lastx[username] <!--{/if}--> <!--{/loop}--> <!--{else}--> Empty <!--{/if}--> </dd> </dl> </div> <!-- End - yugiohhh's Members who have visited in the last X hours - dz.yugiohhh.com -->

Bước cuối cùng: Cập nhật bộ nhớ cache!

Chúc may mắn!

Bình luận về bài viết này