匿名评论未保存在 Drupal 中

发布于 2024-08-13 18:13:56 字数 663 浏览 6 评论 0原文

由于某种原因,我无法再在 Drupal 安装中以匿名用户身份发表评论。我有一段时间没有尝试过,所以我不太确定这个功能是什么时候被破坏的。

我安装了服务,并且可以使用 comment.save 发布匿名评论。如果可能会破坏某些内容,我已经更改了输入格式

我已对匿名用户启用发表评论访问评论。评论不会显示在数据库中。事实上,当我尝试以匿名身份发表评论时,不会调用本机 Drupal 函数 comment_save (我通过在以下位置添加 print_r($edit);die(); 来检查这一点: comment.modulecomment_save 函数的顶部我还读到,没有 UID 0 的用户会破坏匿名评论,该用户存在(显然,因为通过服务发表评论是有效

)我已经尝试了 AntiSpam 模块,并以匿名身份发布了一条评论,该评论会被垃圾邮件过滤器捕获(并且确实如此),但该模块现在已被禁用。

的 这里没有想法了,有人对该怎么做有任何其他建议吗?同时,我将尝试回溯代码以找出为什么 comment_save() 没有被调用。

编辑:匿名用户也不必提交电子邮件等来发帖,如果这有什么关系的话。

For some reason I can no longer post a comment as an Anonymous user in my Drupal installation. I haven't tried in a while, so I'm not quite sure when this functionality was broken.

I have Services installed, and I can post anonymous comments using comment.save. I have altered the Input Formats if that could break something.

I have enabled both post comments and access comments on the anonymous user. The comments does not show up in the database. In fact, the native Drupal function comment_save isn't called when I try to comment as Anonymous (I check this by adding print_r($edit);die(); at the top of the comment_save function in comment.module. Also I read something that not having a User with the UID 0 would break the Anonymous commenting, this user exists (obviously, since commenting through Services works)

I have tried out the AntiSpam module, and posted a comment as Anonymous that would get caught(and did) in the spamfilter, but this module is now disabled.

I'm really running out of ideas here, does anyone have any other suggestions on what to do? In the meanwhile I'm going to attempt to backtrack the code to figure out why comment_save() isn't being called.

Edit: Anonymous users also don't have to submit email and such to post, if that matters in any way.

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

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

发布评论

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

评论(2

枕花眠 2024-08-20 18:13:56

根据你的说法,我怀疑问题出在一些贡献的代码挂在评论表单上并以使其提交失败的方式进行修改。这可能是由多种原因引起的:向表单添加字段而不在服务器上重新生成表单 ID 的 jQuery、更改回调以提交表单的添加或自定义字段等...

我不知道当然可以,但如果我是您,为了检查您的安装情况,我会执行以下操作:

  • 确保您卸载(而不仅仅是禁用)您尝试过的模块并且不要别再用了模块永远不应该触及核心表,但谁知道呢...它不需要任何成本,而且实际上可以释放您的一些数据库。

  • 尝试禁用所有贡献模块,看看是否可以这样发表评论。如果是这种情况,请一次激活一个贡献模块,直到找出罪魁祸首。您很可能已经在 http://drupal.org 上的该模块的问题队列中找到了补丁/解决方法。如果您找不到修复程序,我会调查(xdebug 或手动跟踪)代码,并且我会特别注意 hook_form_alter()hook_form_FORM_ID_alter()

  • 如果即使禁用所有 contrib 模块也没有帮助(对此我会感到非常惊讶),尝试通过全新安装更新核心(如果您认为您的猫有可能走在上面)打开核心文件时的键盘,或 你和 Gordon Brown 的家人住在一起

  • 如果做不到这一点,我想到的唯一替代方案是更加深奥的,例如数据库故障、浏览器上的油脂猴脚本干扰评论以及类似的不太可能的可能性。

哈!

By what you say, I suspect the problem is with some contributed code hooking on the comment form and modifying it in a way that makes it fail submission. This can be caused by a number of causes: a jQuery that adds fields to the form without regenerating the form-id on the server, an added or cusomised field that changes the callback to submit the form, etc...

I cannot know it for sure, but here's what I would do if I were you, in order to check what's up with your installation:

  • Make sure you disinstalled (and not only disabled) the modules you tried and don't use anymore. Modules should never touch core tables, but who knows... It does not cost anything and it actually frees some of your DB.

  • Try disabling all contrib modules and see if you can comment that way. If this is the case, activate the contrib modules one at a time until you find out which one is the culprit. Chances are you will already find a patch/workaround in the issue queue for that module on http://drupal.org. If you don't find a fix, I would investigate (xdebug or manual tracking) the code, and I would pay special attention to all implementations of hook_form_alter() and hook_form_FORM_ID_alter().

  • If even disabling all contrib modules doesn't help (which I would be very astonished of), try updating the core with a fresh installation if you consider as a possibility that your cat walked on the keyboard while you had a core file opened, or you live with Gordon Brown's family.

  • Failing that, the only alternatives coming to my mind are much more esoteric, such DB failure, a greasemonkey script on your browser interfering with commenting and similar unlikely possibilities.

HTH!

无边思念无边月 2024-08-20 18:13:56

我通过重置权限表解决了这个问题(http://drupal.org/node/64114) ,但我会进行适当的备份,并在选项卡中保持权限页面打开,以防万一。

I solved this once by resetting the permissions table (http://drupal.org/node/64114), but I would do a proper backup and keep the permissions page open in a tab, just in case.

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