discuz x2.5 默认显示用户真实姓名-稍加修改也可以默认显示昵称.doc_第1页
discuz x2.5 默认显示用户真实姓名-稍加修改也可以默认显示昵称.doc_第2页
discuz x2.5 默认显示用户真实姓名-稍加修改也可以默认显示昵称.doc_第3页
discuz x2.5 默认显示用户真实姓名-稍加修改也可以默认显示昵称.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

参考地方:/uid-12010107-id-2963778.html首先,打开 source/function/function_core.php ,在里面添加下面的一个函数: /*我增加的函数*/function getnickname($uid) static $nickname_users = array(); if(empty($nickname_users$uid) $nickname_users$uid = C:t(common_member_profile.($fetch_archive = 2 ? _archive : )-fetch($uid); if($fetch_archive = 1 & empty($nickname_users$uid) $nickname_users$uid = C:t(common_member_archive)-fetch($uid); if(!isset($nickname_users$uidself) & $uid = getglobal(uid) & getglobal(uid) $nickname_users$uidself = 1; return $nickname_users$uid; 然后打开 source/include/post/post_newreply.php ,找到:$author = empty($isanonymous) ? $_Gusername : ; 替换成:/*往下数三行我加的程序段(其中这里往下第三行是修改的原来是$author = empty($isanonymous) ? $_Gusername : ;)*/static $temp_author=array();$temp_author=getnickname($_Guid);$author = empty($isanonymous) ? $temp_authorrealname : ;找到第二处: $pid = insertpost(array( fid = $_Gfid, tid = $_Gtid, first = 0, author = $_Gusername,替换成: $pid = insertpost(array( fid = $_Gfid, tid = $_Gtid, first = 0, author = $author,找到第三处:trade_create(array( tid = $_Gtid, pid = $pid, aid = $_GETtradeaid, item_expiration = $_GETitem_expiration, thread = $thread, discuz_uid = $_Guid, author =$_Gusername,替换成:trade_create(array( tid = $_Gtid, pid = $pid, aid = $_GETtradeaid, item_expiration = $_GETitem_expiration, thread = $thread, discuz_uid = $_Guid, author = $author,接下来打开source/include/post/post_newthread.php ,找到: $author = !$isanonymous ? $_Gusername : ;)* 替换成:/*往下数三行我加的程序段(其中这里往下第三行是修改的原来是$author = !$isanonymous ? $_Gusername : ;)*/static $temp_author=array();$temp_author=getnickname($_Guid);$author = !$isanonymous ? $temp_authorrealname : ;找到第二处:$newthread = array( fid = $_Gfid, posttableid = 0, readperm = $readperm, price = $price, typeid = $typeid, sortid = $sortid, author = $_Gusername ,替换成:$newthread = array( fid = $_Gfid, posttableid = 0, readperm = $readperm, price = $price, typeid = $typeid, sortid = $sortid, author = $author,找到第三处: $newthread = array( fid = $_Gfid, posttableid = 0, readperm = $readperm, price = $price, typeid = $typeid, sortid = $sortid, author = $_Gusername , authorid = $_Guid, subject = $subject, dateline = $publishdate, lastpost = $publishdate, lastposter =$_Gusername ,替换成: $newthread = array( fid = $_Gfid, posttableid = 0, readperm = $readperm, price = $price, typeid = $typeid, sortid = $sortid, author = $author, authorid = $_Guid, subject = $subject, dateline = $publishdate, lastpost = $publishdate, lastposter = $author,找到第四处:$pid = insertpost(array( fid = $_Gfid, tid = $tid, first = 1, author = $_Gusername ,替换成:$pid = insertpost(array( fid = $_Gfid, tid = $tid, first = 1, author = $author,找到第五处:$followfeed = array( uid = $_Guid, username = $_Gusername ,替换成: $followfeed = array( uid = $_Guid, username = $author,这样咱们的工作就告一段落了,不过这只能保证改动代码之后用户发的帖子和恢复都会优先显示自定义的昵称,没有昵称才会显示用户名。之前的信息怎么办呢?我看了一下,最需要处理的应该就是帖子列表中的“作者”一栏,其它的比如“最近回复”都会逐渐被后面的新发布的信息顶下去,所以不用关心。这样的话两条 SQL 语句就可以了。首先按照discuz的提示(如果你已经修改好请忽略这步)将 config/config_global.php 当中的 $_configadmincprunquery 设置修改为 1假设你的 discuz 安装的时候使用的数据库表的前缀是 “pre_”, SQL 语句就可以这样写: UPDATE pre_forum_thread AS A, pre_common_member_profile AS B SET A.author=B.realnam

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论