Diễn đàn Trái Tim Yên Bái 2024

 Quên mật khẩu
 Đăng ký
Xem: 3379|Trả lời: 15
Thu gọn cột thông tin

[Discuz 7.2] Members who have visited in the last X hours for Discuz

  [Lấy địa chỉ]

Viết tâm trạng

Đăng lúc 26-12-2009 12:43 PM | Xem tất |Chế độ đọc

Mời bạn đăng ký để giao lưu kết bạn nhé <3

Bạn phải đăng nhập để xem được nội dung, nếu bạn chưa có tài khoản? hãy Đăng ký

x
Original Post: http://dz.yugiohhh.com/yumods/memberswhohavevisitedinthelastxhours


                               
Đăng nhập/Đăng ký mở rộng

Online Demo: http://thpthuongkhe.vn





Note: You can give me your Feedback, Comments & Suggestions about my products here



Author yugiohhh
Tested Discuz Version 7.x
Support Discuz Version 7.x

This adds a simple display of all members who have visited the forum in the last X* hours.

* Option (you can edit in Config Zone)




Step 1: Open include/index_classics.inc.php or index.php (Discuz 7.0) (fixed version)
Find:

  1. include template('discuz');
Sao chép mã


Add above (There are some configuration settings you can edit in Config Zone):
  1. // Start - yugiohhh's Members who have visited in the last X hours - dz.yugiohhh.com
  2. // Start - Config zone (option)
  3. $yu_lasthours = 24; //last x hours
  4. $yu_maxlastxlist = 1000; // limit number of members listed
  5. $yu_boxtitle = 'Members who have visited in the last '.$yu_lasthours.' hours'; // title of visited box
  6. // End - Config zone (option)

  7. $yu_k = time() - ($yu_lasthours * 3600);
  8. $yu_wholastx = array();
  9. $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);
  10. while($yu_lastx = $db->fetch_array($yu_query)) {
  11. $yu_membercount ++;
  12. $yu_lastx['num'] = $yu_membercount;
  13. $yu_lastx['icon'] = isset($_DCACHE['onlinelist'][$yu_lastx['groupid']]) ? $_DCACHE['onlinelist'][$yu_lastx['groupid']] : $_DCACHE['onlinelist'][0];
  14. $yu_lastx['lastactivity'] = gmdate("$dateformat $timeformat", $yu_lastx['lastactivity'] + ($timeoffset * 3600));
  15. $yu_wholastx[] = $yu_lastx;
  16. }
  17. // End - yugiohhh's Members who have visited in the last X hours
Sao chép mã


Step 2: Open discuz.htm of your templates
Find:
  1. $Pluginhooks[index_bottom]
Sao chép mã


Add above:
  1. <!-- 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 -->
Sao chép mã

Cảm ơn

Số người tham gia 4Danh vọng +42 Tiền +40 Thanks +3 Thu lại Lý do
fufu0010 + 1
jajala + 12 + 10
zobibobo + 1
Saokim999 + 30 + 30 + 1

Xem tất cả

Đăng lúc 26-12-2009 04:41 PM | Xem tất
Xóa dấu phẩy cuối, thêm icon cho mỗi user, Good Job
Đăng lúc 31-12-2009 05:34 PM | Xem tất
Trả lời 1# yugiohhh

thanksss
Đăng lúc 31-12-2009 06:44 PM | Xem tất
Discuz! info: MySQL Query Error

User: admin
Time: 2009-12-31 7:44pm
Script: /discuz/index.php

SQL: SELECT s.uid, s.username, s.groupid, s.lastactivity, u.groupid, u.color FROM [Table]members AS s, [Table]usergroups AS u WHERE lastactivity >= 1262259844 AND s.groupid=u.groupid ORDER BY lastactivity DESC LIMIT
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Errno.: 1064

Similar error report has been dispatched to administrator before.

到 http://faq.comsenz.com 搜索此错误的解决方案

Lỗi! Xóa dấu ' nào vậy ak
Đăng lúc 31-12-2009 09:47 PM | Xem tất
Thank...............................
 Tác giả| Đăng lúc 31-12-2009 11:38 PM | Xem tất
Discuz! info: MySQL Query Error

User: admin
Time: 2009-12-31 7:44pm
Script: /discuz/index.php

SQL: ...
Trích từ tinhlagi2122 vào lúc 31-12-2009 06:44 PM


Bạn vào Original Post: http://dz.yugiohhh.com/yumods/me ... itedinthelastxhours
để copy code cho chính xác
Đăng lúc 1-1-2010 06:03 AM | Xem tất
Cám ơn đã share nha !
Nhưng mà có lỗi sau : xem thử tại trang chieuanhquan.net nha.

- Nó gán hết usergroup cho 1 user rồi show ra toàn bộ luôn.

Đã fixed

Đánh giá

Nếu lỗi do mod của em thì bác nêu ra cho em fix với nhé  Đăng lúc 1-1-2010 01:49 PM

Cảm ơn

Số người tham gia 1Thanks +1 Thu lại Lý do
yugiohhh + 1

Xem tất cả

Đăng lúc 2-1-2010 05:17 AM | Xem tất
Không hiểu rõ biến $yu_membercount được gán giá trị thế nào để hiển thị đúng số users visited X h (đối với trường hợp có bật icon của nhóm Khách thăm), mà chỉ thấy bạn cho nó tăng nếu lặp while thôi. Nên trên index của mình nó show giá trị của biến $yu_maxlastxlist (ở đây là 50) - Phải bỏ icon nhóm Khách thăm mới show đúng.

Đánh giá

Note : do thêm phần hiển thị icon của nhóm Khách nên xảy ra lỗi của $yu_membercount  Đăng lúc 2-1-2010 06:36 AM

Cảm ơn

Số người tham gia 1Thanks +1 Thu lại Lý do
yugiohhh + 1

Xem tất cả

 Tác giả| Đăng lúc 2-1-2010 12:09 PM | Xem tất
Không hiểu rõ biến $yu_membercount được gán giá trị thế nào để hiển thị đúng số u ...
Trích từ jajala vào lúc 2-1-2010 05:17 AM


Đùng là em sơ ý chưa tính đến việc khi bật icon của khách thì nó chạy thế nào
Thank bác đã test và tìm ra lỗi. Em sẽ cố gắng fix sớm. Thân!

Đánh giá

Cám ơn bạn đã quan tâm !  Đăng lúc 2-1-2010 02:04 PM
 Tác giả| Đăng lúc 2-1-2010 08:06 PM | Xem tất
Fixed it
Check here: http://dz.yugiohhh.com/yumods/me ... itedinthelastxhours
Bác SK edit giúp em bài trên, em ko edit được nữa
Bạn phải đăng nhập mới được đăng bài Đăng nhập | Đăng ký

Quy tắc điểm

Đóng

Thông báoTrước /1 Sau

Phòng tối|Lưu trữ|Diễn đàn Yên Bái 2024 Community Guidelines |

GMT+7, 6-12-2026 02:58 AM , Processed in 0.025346 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

Trả lời nhanh Lên trên Trở lại danh sách