使用版本:phpBB 2.0.10
狀況描述:
強制使用主題類型:http://phpbb-tw.net/phpbb/viewtopic.php?t=18110
Hide subject field on reply:
代碼: 選擇全部
###############################################
## Hack Title: Hide subject field on reply.
## Hack Version: 1.0.1
## Author: Antony Bailey
## Description: Hides the subject field in posting a reply.
## Compatibility: 2.0.4
##
## Installation Level: Easy
## Installation Time: 5 minutes
## Files To Edit: 3
## posting.php
## privmsgs.php
## posting_body.tpl
##
## History:
## 1.0.0: Started, and blocked in posting.
## 1.0.1: Found and corrected a bug in Private Messaging.
##
## Author Notes:
## The field is un-needed imho.
## The error, with PM's has been fixed, it made it impossible to send a message.
## I wrote this mainly for my forums, but decided to share it as there are like minded people out there.
## Also just another hack, for the list. Gona get to 1500 downloads soon, Patrick.
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ?003 Hide subject field on reply 1.0.1 - Antony Bailey
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('switch_type_toggle', array());
#
#-----[ AFTER, ADD ]------------------------------------------
#
$template->assign_block_vars('switch_allow_subject_on', array());
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('switch_privmsg', array());
#
#-----[ AFTER, ADD ]------------------------------------------
#
$template->assign_block_vars('switch_allow_subject_on', array());
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td>
<td class="row2" width="78%"> <span class="gen">
<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
</span> </td>
</tr>
#
#-----[ REPLACE, WITh ]------------------------------------------
#
<!-- BEGIN switch_allow_subject_on -->
<tr>
<td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td>
<td class="row2" width="78%"> <span class="gen">
<input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" />
</span> </td>
</tr>
<!-- END switch_allow_subject_on -->
#
#-----[ SAVE & CLOSE ALL FILES ]------------------------------------------
#
# End就是回覆文章的時候,因為 Hide subject field on reply 外掛把主題名稱的輸入欄位給隱藏起來,
而強制使用主題類型外掛的 Java scipt 找不到 document.post.subject.value ,於是會跳出瀏覽器的錯誤碼。
沒辦法,我只好把強制使用主題類型外掛給拆掉,結果開始有網友發表主題的時候不加上主題類型.... Orz
後來想到一個解決方法,就是把強制使用主題類型改寫入 functions_post.php 內,
這樣只有網友在發表主題($mode == 'newtopic')的時候,系統才會去檢查有沒有加上主題類型。
如果是回覆文章的時候,系統不會去檢查有沒有加上主題類型,也就不會和 Hide subject field on reply 外掛相衝了。
我試過這樣修改:
代碼: 選擇全部
開啟 functions_post.php ,搜尋:
// Check message
上面加入:
if ($mode == 'newtopic' && $subject != '[')
{
$error_msg .= (!empty($error_msg)) ? '<br />' . $lang['Empty_subject_type'] : $lang['Empty_subject_type'];\r
}
開啟 lang_main.php ,加入:
$lang['Empty_subject_type'] = '發表主題必須選擇主題類型';如果有人知道要怎麼樣把強制使用主題類型改寫到 functions_post.php 內,煩請指教一下,謝謝。
