名稱:
首頁顯示最近註冊的 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 名新會員 - END2. 修改 register.php
找到
複製內容到剪貼簿
代碼:
$styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid'];下面添加
複製內容到剪貼簿
代碼:
//最近註冊的 20 名新會員 - START
require DISCUZ_ROOT.'./include/cache.func.php';
updatecache('new20member');
//最近註冊的 20 名新會員 - END3. 修改 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 名註冊會員 - END4. 修改 ./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
到後台更新快取即可解決