返回首页DA系统C#IDE文件同步服务屏保 今天是: 2026-05-05    "立夏"  夏季的第一个节气,表示盛夏时节的正式开始

搜索
热搜: linux 技术
Hi~登录注册
查看: 1654|回复: 0

[原创] 【原创】Discuz! X3.4论坛发帖标题长度无法超过80个字符限制

[复制链接]
发表于 2021-6-8 21:53:27 | 显示全部楼层 |阅读模式
【原创】Discuz! X3.4论坛发帖标题长度无法超过80个字符限制


1.修改JS验证字符数文件


修改文件.../static/js/forum_post.js

找到:
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {                showError('抱歉,您尚未输入标题或内容');                return false;        } else if(mb_strlen(theform.subject.value) > 80) {                showError('您的标题超过 80 个字符的限制');                return false;        }

修改为:
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {                showError('抱歉,您尚未输入标题或内容');                return false;        } else if(mb_strlen(theform.subject.value) > 120) {                showError('您的标题超过 120 个字符的限制');                return false;        }


2.修改数据库字段大小

use bbsdb

alter table pre_forum_post modify subject varchar(120) DEFAULT NULL COMMENT 'old-varchar(80)';

alter table pre_forum_rsscache modify subject varchar(120) DEFAULT NULL COMMENT  'old-varchar(80)';

alter table pre_forum_thread modify subject char(120) DEFAULT NULL COMMENT 'old-char(80)';

commit;

exit;


3.修改模板中写死的字符限制数

修改文件.../template/default/forum/post_editor_extra.htm

找到:(把80 改成 120)
<!--{if $_GET[action] != 'reply'}-->
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} style="width: 25em" tabindex="1" /></span>
<!--{else}-->
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;">{lang modify}</a>]</span>
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" style="width: 25em" /></span>
<!--{/if}-->
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
<script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>
<!--{/if}-->

修改为:
<!--{if $_GET[action] != 'reply'}--><span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if}#ff0000">120);" style="width: 25em" tabindex="1" /></span><!--{else}--><span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">120);return false;">{lang modify}</a>]</span><span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""FONT-WEIGHT: bold; COLOR: #0000ff">120);" style="width: 25em" /></span><!--{/if}--> <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span><script type="text/javascript">strLenCalc($('subject'), 'checklen', 120)</script><!--{/if}-->




继续找到文件:.../template/default/forum/forumdisplay_fastpost.htm

找到:
<input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>

修改为:
<input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>


4.修改函数验证文件

修改文件:.../source/function/function_post.php

找到:
if(dstrlen($subject) > 80) {return 'post_subject_toolong';}

修改为:
if(dstrlen($subject) > 120) {return 'post_subject_toolong';}


5.修改语言包文件

修改文件:.../source/language/lang_messege.php


找到:
'post_subject_toolong' => '抱歉,您的标题超过 80 个字符修改标题长度'

修改:
'post_subject_toolong' => '抱歉,您的标题超过 120个字符修改标题长度'

6.更新论坛缓存

discuz的后台->工具->更新缓存




更新缓存后,完美~


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册成为修仙之旅的少年~

x
游客
回复
*滑块验证:

DA论坛飞机票来了~
快速回复 返回顶部 返回列表