drupal 论坛函数挂钩在发布之前验证单词列表
如何实现一个钩子来验证我发布的文字? 论坛好像缺少这个功能:禁用词 所以即使我必须制作自己的模块我也想实现一个 我只需要知道要挂钩什么函数
how can I implement a hook to validate the words that I'm posting ?
it seems that the forum lacks that feature: prohibited words
so I want to implement one even if I have to make my own module
I just need to know what function to hook
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您查看过现有的模块吗?
快速搜索即可找到 Wordfilter 和 拼音词过滤器。我建议您尝试一下这些,即使它们没有完全满足您的需要,它们的代码可能会帮助您指明正确的方向。
+++ 编辑 +++
如果您必须在他们发布时执行此操作,请使用 hook_nodeapi
如果您想自动删除单词,请在保存之前运行“presave”操作来更改正文。类似的东西;
或者,如果您想阻止用户在删除任何禁止的单词之前发帖,那么您可以使用“验证”操作。像这样的东西;
Have you looked at the existing modules?
A quick search finds Wordfilter and Phonetic Wordfilter. I would suggest you try these out, even if they don't do exactly what you need their code will probably help point you in the right direction.
+++ EDIT +++
If you must do it when they post then use hook_nodeapi
If you want to remove word automatically then run the 'presave' operation to alter the body before saving. Something along the lines of;
Or if you wanted to prevent the user from posting until they had removed any banned words then you use the 'validate' operation. Something like;