Discuz X2.5 中的會員 DIY 模塊增加了一個今日帖數排行調用條件

但是在模塊代碼中開發人員卻將今日帖數與總帖數進行了合併顯示:
如果模塊屬性中勾選 【按今日發帖數倒序】 條件時,模塊代碼中的 {post} 字段默認顯示的是今日帖數,如果條件中的會員今日帖數為 0 時則調用總帖數!這樣就給我們製作模板時帶來了困惑。

所以以下修改方法將會把今日帖數與總帖數字段獨立出來進行顯示:

打開文件:source/class/lock/member/lock_member.php
查找:

  1. 'posts' =>
    array('name' => lang('blockclass', 'blockclass_member_field_posts'),
    'formtype' => 'text', 'datatype' => 'int'),

下面增加:

  1. 'todayposts' => array('name' => '今日帖數', 'formtype' => 'text', 'datatype' => 'int'),

查找:

  1. 'posts' => empty($todayposts[$data['uid']]) ? $data['posts'] : $todayposts[$data['uid']],

替換為:

  1. 'posts' => $data['posts'],
  2. 'todayposts' => $todayposts[$data['uid']],

最後再去後台更新緩存,勾選 【DIY 模塊分類緩存】!

然後再去前台 DIY 模式中查看結果:


當在模塊屬性中勾選了今日發帖排行條件後,模塊模板中的 {todayposts} 變量才會生效!