Typecho登陆后归档页面私密文章不显示的解决方法

Typecho登陆后,打开归档页面,设置为“私密”属性的文章并不能显示,一定程度上影响了使用体验。

编辑Typecho根目录下的var/Widget/Contents/Post/Recent.php 文件,将

$this->db->fetchAll($this->select()
->where('table.contents.status = ?', 'publish')
->where('table.contents.created options->time)
->where('table.contents.type = ?', 'post')
->order('table.contents.created', Typecho_Db::SORT_DESC)
->limit($this->parameter->pageSize), array($this, 'push'));

改为

if ($this->user->hasLogin()) {
    $this->db->fetchAll($this->select()
    ->where('table.contents.status = ? OR table.contents.status = ?', 'publish','private')
    ->where('table.contents.created options->time)
    ->where('table.contents.type = ?', 'post')
    ->order('table.contents.created', Typecho_Db::SORT_DESC)
    ->limit($this->parameter->pageSize), array($this, 'push'));
} else {
    $this->db->fetchAll($this->select()
    ->where('table.contents.status = ?', 'publish')
    ->where('table.contents.created options->time)
    ->where('table.contents.type = ?', 'post')
    ->order('table.contents.created', Typecho_Db::SORT_DESC)
    ->limit($this->parameter->pageSize), array($this, 'push'));
}

修改完成后,登录并打开归档页面,就可以看到设置为“私密”的文章啦


文章来源于互联网:Typecho登陆后归档页面私密文章不显示的解决方法

赞(0) 打赏
未经允许不得转载:传奇私服 - 传奇私服发布网,最好玩、最新潮的传奇SF尽在眼前 » Typecho登陆后归档页面私密文章不显示的解决方法

评论 224

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址