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} 變數才會生效!