gpt4 book ai didi

drupal - 用户和帖子(和评论)的评分系统

转载 作者:行者123 更新时间:2023-12-04 06:50:07 25 4
gpt4 key购买 nike

我需要实现一个带有评级系统的留言板。类似于堆栈溢出的东西,但要简单得多。

我需要对问题/答案进行评分并计算每个用户的评分。

我正在寻找 Drupal 中的模块来实现它。你能给我一些小费吗?

谢谢

最佳答案

Fivestar , 和 User Points可以用于此目的,但您只会得到类似于 Stack Overflow 的东西。
第一个模块(需要 Voting API )可用于允许用户投票,第二个模块可用于将投票转换为已投票用户的点数(除其他外,该模块不限于此)。要集成这两个模块,还有另一个模块,但我不确定它是“用户点”的一部分,还是 User Points Contributed modules .

Fivestar 的问题是允许用户从 1 到 X 投票(我认为可以更改最大投票数),这与 Stack Overflow 使用的投票系统不同,用户可以简单地报告“我喜欢它” ,或“我不喜欢它”。有了 Fivestar,只有赞成票,没有人可以否决评论或节点;可以通过给予最低投票来降低平均水平。

在我列出的模块之间,没有一个模块可以给节点/评论的作者打分;使用“投票 API”和“用户积分”可以做到这一点,但我看过的任何模块都不允许这样做(这意味着你可能会编写一个自定义模块)。

如果您查看 list of the modules包含在安装配置文件中ArrayShift ,您可以了解可用于实现相同目的的模块。
模块列表包括

  • Node comments ,它转换完整节点中的评论;例如,通过这个模块,可以使用一个投票模块,该模块也只适用于有评论的节点。
  • Voting API .
  • Vote UP/Down允许用户支持或反对投票。
  • User Points .
  • ArrayShift Support Modules ;该模块可能包含允许节点作者在每次他们创建的节点被投票时获得积分的代码。

  • 尤其是作为 ArrayShift Support Modules 一部分的模块。 (as_tweaks) 包含以下代码:
    /**
    * Below, a bunch of simple hook implementations that award userpoints based
    * on various events that happen. In theory, Rules module and various other tools
    * could be used to do these things, but most of those modules don't have easy
    * to export/import configuration data.
    */

    // VotingAPI hook. When a user casts a vote on a node, the author should
    // get/lose points..
    function as_tweaks_votingapi_insert($votes) {
    foreach ($votes as $vote) {
    if ($vote['content_type'] == 'node' && ($node = node_load($vote['content_id']))) {
    // Award the points
    userpoints_userpointsapi(array(
    'uid' => $node->uid,
    'points' => $vote['value'] * 10,
    'operation' => 'vote up',
    'entity_id' => $node->nid,
    'entity_type' => 'node',
    ));
    }
    }
    }

    // VotingAPI hook. When a user casts a vote on a node, the author should
    // get/lose points..
    function as_tweaks_votingapi_delete($votes) {
    foreach ($votes as $vote) {
    if ($vote['content_type'] == 'node' && ($node = node_load($vote['content_id']))) {
    // Award the points
    userpoints_userpointsapi(array(
    'uid' => $node->uid,
    'points' => $vote['value'] * -10,
    'operation' => 'vote up',
    'entity_id' => $node->nid,
    'entity_type' => 'node',
    ));
    }
    }
    }

    关于drupal - 用户和帖子(和评论)的评分系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3258920/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com