列印

首頁顯示最近註冊的 20 名新會員 for Discuz! 6.0.0

首頁顯示最近註冊的 20 名新會員 for Discuz! 6.0.0

名稱:首頁顯示最近註冊的 20 名新會員
適用版本:Discuz! 6.0.0
作者:Linux0911
說明:首頁顯示最近註冊的 20 名新會員。
轉載請註明來源:http://linux0911.no-ip.info/Discuz/
最後更新:2007-09-03 18:00
修改檔案:
./include/cache.func.php
register.php
index.php
./templates/default/discuz.htm
難易程度:國小





開始安裝


1. 修改 ./include/cache.func.php

找到 (添加紅字)
引用:
array('announcements', 'onlinelist', 'forumlinks', 'advs_index', 'supe_updateusers', 'supe_updateitems', 'tags_index', 'new20member'),
找到
複製內容到剪貼簿
代碼:
                case 'magics':
                        $table = 'magics';
                        $cols = 'magicid, available, identifier, name, description, weight, price';
                        break;
下面添加
複製內容到剪貼簿
代碼:
//最近註冊的 20 名新會員 - START
                case 'new20member':
                        $table = 'members';
                        $cols = 'username, regdate, lastvisit, regip, posts';
                        $conditions = "ORDER BY regdate DESC LIMIT 0,20";
                        break;
//最近註冊的 20 名新會員 - END
2. 修改 register.php

找到
複製內容到剪貼簿
代碼:
        $styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];
下面添加
複製內容到剪貼簿
代碼:
//最近註冊的 20 名新會員 - START
        require DISCUZ_ROOT.'./include/cache.func.php';
                updatecache('new20member');
//最近註冊的 20 名新會員 - END
3. 修改 index.php

找到
複製內容到剪貼簿
代碼:
$discuz_action = 1;
下面添加
複製內容到剪貼簿
代碼:
//最近註冊的 20 名新會員 - START
require_once DISCUZ_ROOT.'./include/misc.func.php';
$mem_home = convertip($onlineip, $datadir = "./");
//最近註冊的 20 名新會員 - END
找到 (添加紅字)
引用:
foreach(array('forumlinks', 'birthdays', 'supe_updateusers', 'new20member') as $key) {
找到
複製內容到剪貼簿
代碼:
$gid = !empty($gid) ? intval($gid) : 0;
上面添加
複製內容到剪貼簿
代碼:
// 最近 20 名註冊會員 - START
$new20member = array();
        foreach($_DCACHE['new20member'] as $newmem)
        {
                $newmem['regdate'] = gmdate("$dateformat $timeformat", $newmem[regdate]+ ($timeoffset * 3600));
                $newmem['lastvisit'] = gmdate("$dateformat $timeformat", $newmem[lastvisit]+ ($timeoffset * 3600));
                        if($discuz_uid && $adminid)
                        {
                                $newmem['iplocation'] = convertip($newmem['regip']);
                        }
                $new20member[] = $newmem;
        }
// 最近 20 名註冊會員 - END
4. 修改 ./templates/default/discuz.htm

找到
複製內容到剪貼簿
代碼:
<div class="legend">
        <label><img src="{IMGDIR}/forum_new.gif" alt="{lang forum_newposts}" />{lang forum_newposts}</label>
        <label><img src="{IMGDIR}/forum.gif" alt="{lang forum_nonewpost}" />{lang forum_nonewpost}</label>
</div>
上面添加
複製內容到剪貼簿
代碼:
{template index_newmem}
更新快取

完成!



ps. 如果出現
引用:
Warning: Invalid argument supplied for foreach() in /home/public_html/discuz/index.php on line xxx
到後台更新快取即可解決
附件: 您所在的用戶組無法下載或查看附件
Hack 安裝錯誤, 80% 來自粗心, 請專心安裝
Linux0911 打造您的個性論壇

本人現在忙於研究所, 沒多的時間管論壇, 有問題別發 pm 給我, 謝謝~
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

複製內容到剪貼簿
代碼:
$conditions = "ORDER BY regdate DESC LIMIT 0,30";
要顯示最新的20位新會員
上面的數字應該是20吧

謝謝
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

引用:
原帖由 kongyeah 於 2007-9-20 09:15 AM 發表
$conditions = "ORDER BY regdate DESC LIMIT 0,30";

要顯示最新的20位新會員
上面的數字應該是20吧

謝謝
沒錯, 感謝告知

可自行修改要幾筆資料~
Hack 安裝錯誤, 80% 來自粗心, 請專心安裝
Linux0911 打造您的個性論壇

本人現在忙於研究所, 沒多的時間管論壇, 有問題別發 pm 給我, 謝謝~
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

Warning: include(C:\AppServ\www\bbs\./forumdata/templates/1_index_newmem.tpl.php) [function.include]: failed to open stream: No such file or directory in C:\AppServ\www\bbs\forumdata\templates\1_discuz.tpl.php on line 340

Warning: include() [function.include]: Failed opening 'C:\AppServ\www\bbs\./forumdata/templates/1_index_newmem.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\AppServ\www\bbs\forumdata\templates\1_discuz.tpl.php on line 340

請問大大這是什麼原因
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 4# mly3233 的帖子

沒上傳附件檔案
Hack 安裝錯誤, 80% 來自粗心, 請專心安裝
Linux0911 打造您的個性論壇

本人現在忙於研究所, 沒多的時間管論壇, 有問題別發 pm 給我, 謝謝~
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

請問附件檔要放在哪裡
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 6# trd_wish888 的帖子

按照附件內與論壇對應的相對位置上傳即可! ^^
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

更新快取就是更新緩存嗎~那我怎麼都沒有顯示更改後效果呢
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

回覆 8# trd_wish888 的帖子

是的! 更新快取就是更新緩存

請仔細檢查是否按照步驟修改...

有確實執行第4步驟與上傳附件?
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP

裡面我有掛在虛你遊客這樣有差別嗎
Linux0911 Forum © 2004-2009 All Rights Reserved.

TOP



論壇聲明
  • 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
    如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
    請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!
最佳瀏覽解析度:不低於 1024 (最佳 1280 以上).(支援 IE 7, Mozilla Firefox, Safari, Chrome)
The Best Surfing Resolution: No Lower than 1024 (Best: above 1280).(IE 7, Mozilla Firefox, Safari, Chrome Supported)