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

标签 drupal drupal-6

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

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

我正在寻找 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/

    相关文章:

    php - 无法在 Drupal 6 主题中引用 css 文件来格式化表格

    php - 如何在 git 中管理一个 drupal 网站

    linux - 在重定向时,重定向的页面是否得到处理?

    php - 如何将第一个下拉值设置为无

    Drupal 7 View 上下文过滤器或逻辑

    drupal-6 - 将 Drupal 站点从本地计算机迁移到实时服务器后损坏的图像链接

    drupal - 同一目录中的多个站点但单独的数据库

    drupal - 创建表单提交时如何自动设置 CCK 节点引用字段的值

    drupal - 有没有办法让多个用户或一个角色将照片上传到 drupal 7 中的一个画廊?

    php - 学习多个内容管理系统的成本/ yield