LifeType 1.0/Plugins/karma

LifeType 1.0/Plugins/karma

出自LifeType 中文文件計畫

在2006年11月4日 (六) 08:56由Jeanytu (對話 | 貢獻)所做的修訂版本
跳轉到: 導航, 搜尋


名稱: karma

版本: 1.0

下載連結http://prdownloads.sourceforge.net/lifetype/1.1_karma.zip?download

程式授權: GPL

作者Oscar Renalias

用途

本外掛程式提供文章評鑑功能,允許你的讀者評鑑文章,甚至當文章的負向評鑑值達一定數量時,讓文章自動從前端下架。

設定

After unpacking the plugin, make sure to move the karma.php file to the root folder of pLog, so that it appears at the same level as index.php or admin.php. If not, the plugin will not work and you will get repeated 404 errors when trying to place votes for a post.

The plugin uses 2 custom post fields in order to store the information about votes, so it is not advisable to remove these fields:

  • positiveVotes
  • negativeVotes

Posts that have been moderated down will be marked with a custom status called "Karma Moderated down". In order to change either the status of the moderation status of the post or the number of votes it has received, the only thing we need to is to edit the post and save it. However, this is not recommended.

The following changes to the postandcomments.template files are needed in order to display the correct links to allow users to give positive or negative votes to a post:

  1. {if !empty($karma)}
  2. {if $karma->isEnabled()}
  3. {assign">assign">assign var="positiveKarma" value=$post->getField("positiveKarma")}
  4. {if $positiveKarma == ""}{assign">assign">assign var="positiveKarma" value=0}{/if}
  5. {assign">assign">assign var="negativeKarma" value=$post->getField("negativeKarma")}
  6. {if $negativeKarma == ""}{assign">assign">assign var="negativeKarma" value=0}{/if}
  7.  :: {$locale->tr("karma")} (<a href="{$karma->getPositiveUrl($post)}">+{$positiveKarma}</a>/<a href="{$karma->getNegativeUrl($post)}">-{$negativeKarma}</a>)
  8. {/if}
  9. {/if}

It is also possible to make the plugin generate a page including all the moderated down articles. In order to create a link to that page, add the following Smarty code anywhere in your templates:

  1. {if !empty($karma)}
  2. {if $karma->isEnabled()}
  3. <li><a title="{$locale->tr("karma_moderated_down_articles")}" href="{$karma->pluginTemplatePage()}">{$locale->tr("karma_moderated_down_articles")}</a></li>
  4. {/if}
  5. {/if}

The template used to generate this page can be found under plugins/karma/templates/moderateddownlist.template. The same template file is used for all blogs.

注意事項