XML RPC wordpress 匿名评论发布
我在我的博客上发布评论,它工作正常,但有一个问题,我无法使用 alexjamesbrown 的 XML-RPC
而不是评论作者来发布匿名评论,这里是管理员名称
,这是我的代码
var wrapper = new WordPressWrapper(textblogUrltemp + "/xmlrpc.php", adminunUser, adminPass);
var post = new Post();
post.title = toPost.VideoTitle;
post.dateCreated = Convert.ToDateTime(toPost.PostingDateTime);
post.description = toPost.VideoCode;
post.postid = wrapper.NewPost(post, true);
var comment = new Comment();
var wrap =new WordPressWrapper(textblogUrltemp + "/xmlrpc.php", adminunUser, adminPass);
comment.author = videoComments.userName;
comment.author_email = videoComments.email;
comment.content = videoComments.Comment;
wrap.NewComment(post.postid, comment);
i am posting comments on my blog it works fine but there is one problem that i cannot post anonymous comments using XML-RPC by alexjamesbrown
instead of comment author there is name of admin
here is my code
var wrapper = new WordPressWrapper(textblogUrltemp + "/xmlrpc.php", adminunUser, adminPass);
var post = new Post();
post.title = toPost.VideoTitle;
post.dateCreated = Convert.ToDateTime(toPost.PostingDateTime);
post.description = toPost.VideoCode;
post.postid = wrapper.NewPost(post, true);
var comment = new Comment();
var wrap =new WordPressWrapper(textblogUrltemp + "/xmlrpc.php", adminunUser, adminPass);
comment.author = videoComments.userName;
comment.author_email = videoComments.email;
comment.content = videoComments.Comment;
wrap.NewComment(post.postid, comment);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了它
,您还需要修改
class-wp-xmlrpc-server.php
文件并在 newComment 函数中允许匿名评论I resolved it
also you need to modify the
class-wp-xmlrpc-server.php
file and in newComment function allow the anonymous comments我在 WP Remote Control 中遇到了这个问题。通过 XMLRPC 解锁匿名发布是非常糟糕的主意。正如任何人都可以做到的那样,您可能会被垃圾邮件淹没。
秘密是发布评论并编辑它。有两个请求,但你很安全。在我的课堂上有一个方法可以做到这一点。问候。
顺便说一句:我的课程是 PHP。我也用 C++ 编写了它,但它太依赖于我的 C++ 库而无法发布。
I bumped into this working for WP Remote Control. Very bad idea to unlock anonymous posting through XMLRPC. You can get flooded by Spam as anyone can do it.
The secret is to post the comment and edit it. Two requests but you're safe. There's a single method that does it in my class. Regards.
BTW: My class is PHP. I have it written in C++ too but it's too dependent to my C++ library to publish.