·设为首页收藏本站📧邮箱修改🎁免费下载专区🔐设置/修改密码👽群雄群聊
返回列表 发布新帖

Discuz!X2.5用户UID链接伪静态修改,并解决由于用户名静态出现的问题,附伪静态规则

430 1
发表于 2020-7-7 10:30:59 | 显示全部楼层 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
使用平台:Dx2.5、IIS7.5

知识点:
1、首页、文章列表页的用户链接伪静态化。
例如:(http://www.discuz.net/home.php?mod=space&uid=859)转换为(http://www.discuz.net/uid-859.html)

2、可解决:伪静态开启,用户名是中文的,查看用户空间提示【抱歉,您指定的用户空间不存在】(http://www.discuz.net/thread-2621478-1-1.html)

3、官方后台提供的伪静态规则已经过时,这里仅提供适用于该主题的伪静态规则。IIS7.5(web.config)使用。

Discuz!X2.5用户UID链接伪静态修改,并解决由于用户名静态出现的问题,附伪静态规则 用户,链接,伪静态,修改,解决


1、 ../source/function/function_forum.php    //函数库
修改:末尾添加
  1. //自定义函数function GetLastPosterId($UserName)//最后回复UID{        $sql = DB::query("SELECT uid FROM " . DB::table('common_member') . " WHERE username = '$UserName'");        $row = DB::fetch($sql);        return $row['uid'];}
复制代码
保留末尾:?>

2、 ../source/function/function_forumlist.php   //论坛首页
修改前:
  1. $lastpost['author'] = '<a href="home.php?mod=space&username='.rawurlencode($lastpost['author']).'">'.$lastpost['author'].'</a>';
复制代码
修改后:
  1. $lastpost['author'] = '<a href="home.php?mod=space&uid='.GetLastPosterId($lastpost['author']).'" target="_blank">'.$lastpost['author'].'</a>';
复制代码
3、 ../template/default/forum/forumdisplay_list.htm  //列表页
修改前:
  1. <a href="{if $thread[digest] != -2}home.php?mod=space&username=$thread[lastposterenc]{else}forum.php?mod=viewthread&tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}" c="1">$thread[lastposter]</a>
复制代码
修改后:
  1. <a href="{if $thread[digest] != -2}home.php?mod=space&uid={echo GetLastPosterId($thread[lastposter]);}{else}forum.php?mod=viewthread&tid=$thread[tid]&page={echo max(1, $thread[pages]);}{/if}" c="1">$thread[lastposter]</a>
复制代码
PS:需要对应的伪静态规则,否则会报错。

以上内容Dx2.0和Dx2.5是一致的,下边提供伪静态规则:
注意:该规则为Web.config文件,其他环境请自行对照修改。
我要说一句 收起回复
一花一世界,一叶一追寻。一曲一场叹,一生为一人。

评论1

浅生Lv.8 发表于 2020-7-7 10:31:09 | 显示全部楼层
[s_catsoul=5]给力![/s_catsoul]
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图

您的IP:18.220.140.5,121.14.135.58,GMT+8, 2024-4-26 18:07 , Processed in 0.161591 second(s), 78 queries , Gzip On, Redis On.

Based on Discuz! W1.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表