April 12, 2009
鼓勵此網誌:13
最近 dllee 加入了 BO 樂區,她是一個內容廣泛的論譠,雖然目前幾乎都是部落軌道的會員,但是,BO 樂區並沒有限定要有部落軌道帳號才能申請,不需要介紹信,也不需要繁雜的登錄資料,只要您有 EMail ,就能申請一個帳號。您還沒加入過論譠嗎?還是您已是論譠老手?快到BO 樂區去看看有什麼好玩的新鮮事吧 
因為 dllee 喜歡要求新功能的個性很難改,所以,在BO 樂區一樣開出了一些功能要求,又因為某些原因,dllee 加入了管理團隊,變成自己要求的功能得自己去完成了
以下就來說明,如何在 Discuz! 7.0 「我的帖子」的 [主題] 及 [回覆] 按最後回覆排序。
以上格式在使用 phpBB 時蠻常見也蠻常用的,我就用相同的格式來記錄修改囉
最近需要把論壇加上圖檔 Hosting 的功能,因為論壇的空間及頻寬有限,希望使用 Picasa, flickr, ImageShack 等支援圖片外連的網路相簿站,讓會員透過論壇上傳圖片到指定的空間,再貼到論壇內,讓論壇的文章有比較好的完整性。關於此部分,還在努力找資料中,如果有好的插件或建議,也歡迎您留言告知唷,萬分感謝
※ BO 樂區 紀事
2009-03-25 BO 樂區成立,由索尼斯找熱心部落軌道的Bo動客加入
2009-03-25 dllee 擔任BO 樂區 Windows 軟體版版主
2009-04-07 BO 樂區開放註冊
2009-04-11 dllee 加入BO 樂區管理團隊

因為 dllee 喜歡要求新功能的個性很難改,所以,在BO 樂區一樣開出了一些功能要求,又因為某些原因,dllee 加入了管理團隊,變成自己要求的功能得自己去完成了

以下就來說明,如何在 Discuz! 7.0 「我的帖子」的 [主題] 及 [回覆] 按最後回覆排序。
##############################################################
## MOD Title: Discuz! 7.0.0 add Sort by Last Reply for MyPosts
## MOD Author: dllee http://blog.yam.com/dllee
## MOD Description: Discuz! 7.0.0 add Sort by Last Reply for MyPosts
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit: my.php, templates/default/my.htm, templates/default/templates.lang.php
## Included Files: n/a
##############################################################
## Author Notes: None
##
##############################################################
## MOD History:
##
## 2009-04-11 - Version 1.0.0
## - First released.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
/my.php
#
#-----[ FIND ]------------------------------------------
# line 105
$query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}mythreads m, {$tablepre}threads t
WHERE m.uid = '$discuz_uid' $threadadd AND m.tid=t.tid ORDER BY m.dateline DESC LIMIT $start_limit, $tpp");
#
#-----[ MODIFY ]------------------------------------------
#
$sortfield='m.dateline'; /* 2009-04-11 dllee : Add Sort by LastPost */
if($type == 'lastpost') {
$sortfield='t.lastpost';
}
$query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}mythreads m, {$tablepre}threads t
WHERE m.uid = '$discuz_uid' $threadadd AND m.tid=t.tid ORDER BY $sortfield DESC LIMIT $start_limit, $tpp");
#
#-----[ FIND ]------------------------------------------
# line 134
$query = $db->query("SELECT m.uid, m.tid, m.pid, p.fid, p.invisible, p.dateline FROM {$tablepre}myposts m
INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd
INNER JOIN {$tablepre}threads t ON t.tid=m.tid $threadadd
WHERE m.uid = '$discuz_uid' ORDER BY m.dateline DESC LIMIT $start_limit, $tpp");
#
#-----[ MODIFY ]------------------------------------------
#
$sortfield='m.dateline'; /* 2009-04-11 dllee : Add Sort by LastPost */
if($type == 'lastpost') {
$sortfield='t.lastpost';
}
$query = $db->query("SELECT m.uid, m.tid, m.pid, p.fid, p.invisible, p.dateline FROM {$tablepre}myposts m
INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd
INNER JOIN {$tablepre}threads t ON t.tid=m.tid $threadadd
WHERE m.uid = '$discuz_uid' ORDER BY $sortfield DESC LIMIT $start_limit, $tpp");
#
#-----[ OPEN ]------------------------------------------
#
/templates/default/my.htm
#
#-----[ FIND ]------------------------------------------
# line 19
<li<!--{if empty($item) || $item == 'threads'}--> class="current"<!--{/if}-->><a href="my.php?item=threads$extrafid" hidefocus="true"><span>{lang thread}</span></a></li>
<li<!--{if $item == 'posts'}--> class="current"<!--{/if}-->><a href="my.php?item=posts$extrafid" hidefocus="true"><span>{lang reply}</span></a></li>
#
#-----[ MODIFY ]------------------------------------------
#
<li id="threads" onmouseover="showMenu(this.id)"<!--{if empty($item) || $item == 'threads'}--> class="current"<!--{/if}-->><a href="my.php?item=threads$extrafid" hidefocus="true" class="dropmenu"><span>{lang thread}</span></a></li>
<li id="posts" onmouseover="showMenu(this.id)"<!--{if $item == 'posts'}--> class="current"<!--{/if}-->><a href="my.php?item=posts$extrafid" hidefocus="true" class="dropmenu"><span>{lang reply}</span></a></li>
#
#-----[ FIND ]------------------------------------------
# line 70
{template my_buddylist}
<!--{/if}-->
</div>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<ul class="popupmenu_popup titlemenu_popup" id="threads_menu" style="display: none">
<li <!--{if (empty($item) || $item == 'threads') && $type <> 'lastpost'}--> class="current"<!--{/if}-->><a href="my.php?item=threads&type=postdate$extrafid">{lang my_sortbypostdate}</a></li>
<li <!--{if (empty($item) || $item == 'threads') && $type == 'lastpost'}--> class="current"<!--{/if}-->><a href="my.php?item=threads&type=lastpost$extrafid">{lang my_sortbylastpost}</a></li>
</ul>
<ul class="popupmenu_popup titlemenu_popup" id="posts_menu" style="display: none">
<li <!--{if $item == 'posts' && $type <> 'lastpost'}--> class="current"<!--{/if}-->><a href="my.php?item=posts&type=postdate$extrafid">{lang my_sortbypostdate}</a></li>
<li <!--{if $item == 'posts' && $type == 'lastpost'}--> class="current"<!--{/if}-->><a href="my.php?item=posts&type=lastpost$extrafid">{lang my_sortbylastpost}</a></li>
</ul>
#
#-----[ OPEN ]------------------------------------------
#
/templates/default/templates.lang.php
#
#-----[ FIND ]------------------------------------------
# line 739
'my_forum_all' => '顯示全部',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'my_sortbypostdate' => '按發表時間排序',
'my_sortbylastpost' => '按最後回覆排序',
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
以上格式在使用 phpBB 時蠻常見也蠻常用的,我就用相同的格式來記錄修改囉

最近需要把論壇加上圖檔 Hosting 的功能,因為論壇的空間及頻寬有限,希望使用 Picasa, flickr, ImageShack 等支援圖片外連的網路相簿站,讓會員透過論壇上傳圖片到指定的空間,再貼到論壇內,讓論壇的文章有比較好的完整性。關於此部分,還在努力找資料中,如果有好的插件或建議,也歡迎您留言告知唷,萬分感謝
※ BO 樂區 紀事
2009-03-25 BO 樂區成立,由索尼斯找熱心部落軌道的Bo動客加入
2009-03-25 dllee 擔任BO 樂區 Windows 軟體版版主
2009-04-07 BO 樂區開放註冊
2009-04-11 dllee 加入BO 樂區管理團隊




















