Drupal模块控制用户发帖频率?

发布于 2024-09-30 22:54:03 字数 469 浏览 5 评论 0原文

本周,PortableApps.com 上出现了一种新型垃圾邮件机器人,其发布速度约为 10 条评论一分钟而且似乎没有停止 - 至少在第一个小时左右(到目前为止我们总是在那段时间内停止)。上周我们已经遇到了大约十几次 - 有时将其阻止在 50 或 60 个,有时高达 250 或 300 个。我们正在努力尽可能地阻止它和其他垃圾邮件机器人,但目前它是仍然是一个真正的害虫。

我想知道是否同时有任何类型的模块可以控制用户发帖的频率,例如新用户每小时 50 条或每小时 10 条。这至少意味着我们不必在 admin/content/comment 中一次清除 300 条评论(每次 50 条),而需要清除的评论数量会更少。 (添加一个页面来删除用户所有内容并阻止它们的模块也会很有帮助!)

我相信有一个插件可以为 WordPress 执行此操作,但在 Drupal 中找不到任何这样的东西。

We've been having a new type of spam-bot this week at PortableApps.com which posts at a rate of about 10 comments a minute and doesn't seem to stop - at least the first hour or so (we've always stopped it within that time so far). We've had them about a dozen times in the last week - sometimes stopping it at 50 or 60, sometimes up to 250 or 300. We're working to stop it and other spam bots as much as possible, but at the moment it's still a real pest.

I was wondering whether in the mean time whether there's any sort of module to control the frequency a user can post at to e.g. 50 an hour or something like 10 in an hour for new users. That at least would mean that instead of having to clear up 300 comments 50 at a time in admin/content/comment we'd have a smaller number to clear. (A module to add a page to delete all content by a user and block them would also be helpful!)

I believe that there's a plugin to do this available for WordPress, but can't find any such thing for Drupal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

熊抱啵儿 2024-10-07 22:54:03

对于你的第二个问题,我将查看用户删除模块(点击)的代码。

该模块还禁用用户帐户并取消发布特定用户的所有节点/评论。通过扩展代码,您可以轻松创建另一种可能性来取消发布+删除某个用户的所有节点/评论并阻止该帐户。

在模块中取消发布代码后,您应该只放置删除代码(如果模块通过 sql 查询或使用 drupal 删除函数进行选择,则在 sql 中)。


另一种选择是创建一个仅由管理员查看的视图(使用视图模块),您可以使用过滤器选择某个用户,然后列出他/她的帖子。然后在 node-contenttype.tpl.php 中放置一个按钮,该按钮调用一个删除所有节点/评论和用户的函数。


第一个问题(发帖频率

我一直在考虑评论发帖限制。如果我没记错的话,Drupal 将注释存储在单独的表中,并且具有注释特定的功能。

我将创建一个新模块并使用 comment_nodeapi 函数 我会在“插入”操作中检查当前用户在特定时间范围内已经发表了多少评论。

为了检查这一点,我将在数据库上编写一个自定义 sql 查询,该查询获取 uid 所做的所有评论的计数,其中 post_date 大于 NOW-1 小时。如果该计数大于 10 或 15 或您想要的任何发布频率,那么您给出 一条消息返回给用户。您可以使用全局 $user 变量检索用户 ID 和名称。

(例如: print $user->name;

您必须自行检查 sql 查询,但是当您有金额时,这里有一些代码:(

<?php
function comment_nodeapi(&$node, $op, $arg = 0) {
  switch ($op) {

    case 'insert':
      //PLACE HERE THE SQL TO GET THE COUNT
      if($count > 15){
          $repeat = FALSE;
          $type = 'status'
          drupal_set_message("You have reached the comment limit for this time.", $type, $repeat);
          break;
      }else{
          db_query('INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, %d, NULL, %d, 0)', $node->nid, $node->changed, $node->uid);
          break;
      }
   }
}
?>

此代码尚未经过测试,因此不能保证,但这应该会让你走上正轨)

For your second question, i would have a look at the code of the User Delete module (click).

The module also disables the user account and unpublished all nodes/comments from a certain user. By extending the code, you could easily create another possibility to unpublish + delete all nodes/comments from a certain user and blocking the account.

After the unpublish code in the module, you should just put delete code (in sql if the module is selecting by a sql-query or by using the drupal delete functions).


Another option would be so make a view (using the view module) only to be viewed by administrators, where you choose a certain user using the filters and then lists his/her posts. Then in the node-contenttype.tpl.php you place a button that calls a function which deletes all nodes/comments and the user.


First problem (post frequency)

I've been thinking about the comment post limit. If I remember correctly Drupal stores comments in a seperate table and has comment specific functions.

I'd create a new module and using the comment_nodeapi function i would check in the operation 'insert' how much comments the current user has already made within a certain timeframe.

To check this I would write a custom sql query on the database which takes the count of alle comments made by uid where the post_date is larger then NOW-1hour. If that count is larger then 10 or 15 or whatever post frequency you want then you give a message back to the user. You can retrieve the user id and name by using the global $user variable.

(example: print $user->name;)

You have to check on your own for the sql query but here's some code when you have the amount:

<?php
function comment_nodeapi(&$node, $op, $arg = 0) {
  switch ($op) {

    case 'insert':
      //PLACE HERE THE SQL TO GET THE COUNT
      if($count > 15){
          $repeat = FALSE;
          $type = 'status'
          drupal_set_message("You have reached the comment limit for this time.", $type, $repeat);
          break;
      }else{
          db_query('INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, %d, NULL, %d, 0)', $node->nid, $node->changed, $node->uid);
          break;
      }
   }
}
?>

(this code has not been tested so no guarantees, but this should put you on the right track)

娇柔作态 2024-10-07 22:54:03

我建议类似 Mollom (来自 Drupal 的创建者)。它会扫描邮件中的已知垃圾邮件模式/关键字/...,如果扫描失败,它会向用户显示验证码,以确保是真人想要输入与垃圾邮件具有相同属性的内容。

他们提供免费服务和一些付费解决方案。我们正在为一些客户使用它,它物有所值。它还与 Drupal 集成得很好。

I would suggest something like Mollom (from the creator of Drupal). It scans the message for known spam pattern/keywords/... and if this scan fails, it displays a CAPTCHA to the user to make sure that it's a real human that wants to enter content that has the same properties like spam.

They offer a free service and some paid solutions. We are using it for some customers and it's worth the money. It also integrates very well in Drupal.

过期以后 2024-10-07 22:54:03

评论限制可能正是您所需要的。

Comment Limit is probably what you need.

清泪尽 2024-10-07 22:54:03

http://drupal.org/project/spam
http://drupal.org/project/antispam - 具有 akismet 支持

http://drupal.org/project/spam
http://drupal.org/project/antispam - with akismet support

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文