エントリー

ユーザー登録記事数表示プラグイン

このプラグインについて

  • freoの登録ユーザー(権限が管理者、投稿者の場合)が投稿した記事(エントリー)の数を表示するプラグインです。
  • 未承認や公開されていない記事はカウントされません。
  • プロフィール(プロフィール拡張プラグインを含む)や管理画面でも表示可能です。

ダウンロード

こちら からプラグインをダウンロードできます。

導入方法

【ファイルのアップロード】
user_entry_count/ 内の libs/ を、freo設置ディレクトリ内にアスキーモードで上書きアップロードします。

機能解説

【サイドバーのユーザーリンクで使用する場合】
templates/internals/utility.html の100行目あたりにある

<li><a href="{$freo.core.http_file}/profile/{$refer_user.id}">{$refer_user.name}</a></li>

の部分を、

<li><a href="{$freo.core.http_file}/profile/{$refer_user.id}">{$refer_user.name}</a>({$plugin_user_entry_counts[$refer_user.id]})</li>

に変更(赤字の部分を追加)してください。

【プロフィールで使用する場合】
templates/internals/profile/default.html の28行目の登録記事の項目の下に、

<dt>登録記事数</dt>
  <dd>{$plugin_user_entry_counts[$user.id]}</dd>

を追加してください。

【プロフィール拡張プラグインのプロフィール一覧で使用する場合】
templates/plugins/profile/default.html の13~19行目と22~28行目の2箇所にある

<tr>
  <th>ID</th>
  <th>名前</th>
  <th>フリガナ</th>
  <th>カテゴリー</th>
  <th>タグ</th>
</tr>

の部分を、

<tr>
  <th>ID</th>
  <th>名前</th>
  <th>フリガナ</th>
  <th>エントリー数</th>
  <th>カテゴリー</th>
  <th>タグ</th>
</tr>

に変更(赤字の部分を追加)し、 同じく31~39行目あたりの

<!--{foreach from=$plugin_profiles|smarty:nodefaults item='plugin_profile'}-->
<tr>
  <td><a href="{$freo.core.http_file}/profile/{$plugin_profile.user_id}">{$plugin_profile.user_id}</a></td>
  <td>{$users[$plugin_profile.user_id].name}</td>
  <td>{$plugin_profile.kana}</td>
  <td><!--{if $plugin_profile.category_id}--><a href="{$freo.core.http_file}/profile?category={$plugin_profile.category_id}">{$plugin_profile_categories[$plugin_profile.category_id].name}</a><!--{/if}--></td>
  <td><!--{foreach from=$plugin_profile_tags[$plugin_profile.user_id]|smarty:nodefaults item='plugin_profile_tag' name='loop'}--><a href="{$freo.core.http_file}/profile?tag={$plugin_profile_tag|smarty:nodefaults|escape:'url'}">{$plugin_profile_tag}</a><!--{if !$smarty.foreach.loop.last}-->,&nbsp;<!--{/if}--><!--{/foreach}--></td>
</tr>
<!--{/foreach}-->

の部分を、

<!--{foreach from=$plugin_profiles|smarty:nodefaults item='plugin_profile'}-->
<tr>
  <td><a href="{$freo.core.http_file}/profile/{$plugin_profile.user_id}">{$plugin_profile.user_id}</a></td>
  <td>{$users[$plugin_profile.user_id].name}</td>
  <td>{$plugin_profile.kana}</td>
  <td><!--{if $users[$plugin_profile.user_id].authority == 'root' or $users[$plugin_profile.user_id].authority == 'author'}-->{$plugin_user_entry_counts[$plugin_profile.user_id]}<!--{/if}--></td>
  <td><!--{if $plugin_profile.category_id}--><a href="{$freo.core.http_file}/profile?category={$plugin_profile.category_id}">{$plugin_profile_categories[$plugin_profile.category_id].name}</a><!--{/if}--></td>
  <td><!--{foreach from=$plugin_profile_tags[$plugin_profile.user_id]|smarty:nodefaults item='plugin_profile_tag' name='loop'}--><a href="{$freo.core.http_file}/profile?tag={$plugin_profile_tag|smarty:nodefaults|escape:'url'}">{$plugin_profile_tag}</a><!--{if !$smarty.foreach.loop.last}-->,&nbsp;<!--{/if}--><!--{/foreach}--></td>
</tr>
<!--{/foreach}-->

に変更(赤字の部分を追加)してください。

【管理画面のユーザー管理で使用する場合】
templates/internals/admin/user.html の27~34行目と37~44行目の2箇所にある

<tr>
  <th>ID</th>
  <th>登録日時</th>
  <th>名前</th>
  <th>承認</th>
  <th>権限</th>
  <th>作業</th>
</tr>

の部分を、

<tr>
  <th>ID</th>
  <th>登録日時</th>
  <th>名前</th>
  <th>エントリー数</th>
  <th>承認</th>
  <th>権限</th>
  <th>作業</th>
</tr>

に変更(赤字の部分を追加)し、同じく47~62行目あたりの

<!--{foreach from=$users|smarty:nodefaults item='user'}-->
<tr>
  <td>{$user.id}</td>
  <td><!--{if $user.created|date_format:'%Y%m%d' == $smarty.now|date_format:'%Y%m%d'}-->{$user.created|date_format:'%H:%M:%S'}<!--{else}-->{$user.created|date_format:'%Y/%m/%d'}<!--{/if}--></td>
  <td>{$user.name}</td>
  <td><!--{if $user.approved == 'yes'}-->承認済<!--{elseif $user.approved == 'no'}-->未承認<!--{/if}--></td>
  <td><!--{if $user.authority == 'root'}-->管理者<!--{elseif $user.authority == 'author'}-->投稿者<!--{elseif $user.authority == 'guest'}-->ゲスト<!--{/if}--></td>
  <td>
    <a href="{$freo.core.http_file}/profile/{$user.id}">確認</a>
    <!--{if $freo.user.id != $user.id}-->
    <a href="{$freo.core.http_file}/admin/user_form?id={$user.id}">編集</a>
    <a href="{$freo.core.http_file}/admin/user_form?id={$user.id}#user_delete">削除</a>
    <!--{/if}-->
  </td>
</tr>
<!--{/foreach}-->

の部分を、

<!--{foreach from=$users|smarty:nodefaults item='user'}-->
<tr>
  <td>{$user.id}</td>
  <td><!--{if $user.created|date_format:'%Y%m%d' == $smarty.now|date_format:'%Y%m%d'}-->{$user.created|date_format:'%H:%M:%S'}<!--{else}-->{$user.created|date_format:'%Y/%m/%d'}<!--{/if}--></td>
  <td>{$user.name}</td>
  <td><!--{if $user.authority == 'root' or $user.authority == 'author'}-->{$plugin_user_entry_counts[$user.id]}<!--{/if}--></td>
  <td><!--{if $user.approved == 'yes'}-->承認済<!--{elseif $user.approved == 'no'}-->未承認<!--{/if}--></td>
  <td><!--{if $user.authority == 'root'}-->管理者<!--{elseif $user.authority == 'author'}-->投稿者<!--{elseif $user.authority == 'guest'}-->ゲスト<!--{/if}--></td>
  <td>
    <a href="{$freo.core.http_file}/profile/{$user.id}">確認</a>
    <!--{if $freo.user.id != $user.id}-->
    <a href="{$freo.core.http_file}/admin/user_form?id={$user.id}">編集</a>
    <a href="{$freo.core.http_file}/admin/user_form?id={$user.id}#user_delete">削除</a>
    <!--{/if}-->
  </td>
</tr>
<!--{/foreach}-->

に変更(赤字の部分を追加)してください。

削除方法

以下のファイルを削除します。

  • libs/freo/plugins/config.user_entry_count.php
  • libs/freo/plugins/display.user_entry_count.php

更新履歴

2014/08/16 Ver 1.0.0公開しました。

※このプラグインのentry(entries)をpage(pages)に置き換えればユーザー登録ページ数表示プラグインができるかもしれませんが試していません。

ページ移動

関連エントリー

コメント

羽布

利用しています。作成ありがとうございました。
ページへの流用もなんとかできました。

以下、カスタマイズ素人(私)が躓いたポイントについて。
config.user_entry_count.phpからconfig.user_page_count.phpへの変更で、'default,entry,category,view,profile,admin'を'default,page,profile,admin'とします。
それを踏まえてdisplay.user_entry_count.phpからdisplay.user_page_count.phpへの変更時に、entriesをpagesに、entryとviewをpageに一括置き換え‥‥してはいけません。
$freo->config['view']['restricted_display']のviewは管理メニューの表示設定で、エントリー表示のviewではありません。
当プラグイン公開記事にアドバイスがありますとおり、entriesをpagesに、entryをpageに置き換えます。
加えて'intval'をarray($freo->pdo, 'quote')に置き換えるようです。

  • 2020/06/04 09:32:21

コメント登録

  • コメントを入力してください。
  • 一旦登録したコメントは、あとで編集できませんのでご注意下さい。
登録フォーム

基本的には「全体に公開」されますが、内容によっては管理人の方で公開を制限する場合がありますので、その旨ご了承下さい。

ユーティリティ

2024年03月

- - - - - 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 - - - - - -

キーワード検索

キーワード検索フォーム

ユーザー

  • cccのアバター

新着画像

ブログパーツ

Twitter

Twilogを見る

Feed