我需要创建一个wordpress插件来将wordpress连接到中央登录。但我想要的只是用户能够发布带有姓名和电子邮件的评论。我不认为我需要在wordpress中创建一个真正的loggin,因为用户不应该写帖子或做管理员的东西。我希望他只发表评论。
我搜索documentation但找不到任何评论操作。
如何更改评论表单的html?
答案 0 :(得分:0)
也许不好但是有效......
从会话中存储的中央登录名填写评论作者和电子邮件:
function portal_user_comment()
{
$_POST['author'] = $_SESSION['portal']['name'];
$_POST['email'] = $_SESSION['portal']['email'];
}
add_action('pre_comment_on_post', 'portal_user_comment');
从模板中编辑comments.php。寻找:
<input type="text" name="author" id="author" value="<?php $comment_author; ?>" ...>
<input type="text" name="email" id="email" value="<?php $comment_author_email; ?>" ...>
设置两个字段disabled="true"
,并使用作者和会话中的电子邮件替换值。