wp.newComment (XML-RPC) bug?
-
Hello, I hope that I’m in the right forum.
Here’s my problem. I’m trying to post comments with the WP XML-RPC API.
http://codex.wordpress.org/XML-RPC_wp#wp.newComment
The problem is I want these comments to appears under the name of the commenter, but they always appear under the name of the administrator.I have changed the settings in WP to allow to comments without registration. I have also installed the plugin that allow anonymous comment from XML-RPC.
http://www.thepicklingjar.com/code/anonymous-xmlrpc-comments/
The only thing that is working is hacking the source, specifically this file:
xmlrpc.php
In the function wp_newComment, I added this line in this block of code:
if ( ! get_post($post_id) ) return new IXR_Error( 404, __( 'Invalid post ID.' ) ); $comment['comment_post_ID'] = $post_id; // emm: dirty hack: 2009-08-25 $logged_in = FALSE; if ( $logged_in ) { $comment['comment_author'] = $wpdb->escape( $user->display_name ); $comment['comment_author_email'] = $wpdb->escape( $user->user_email ); $comment['comment_author_url'] = $wpdb->escape( $user->user_url );
With this small hack, everything work fines with XML-RPC, and I can see the comment under the name/email of the commenter. Plus I can moderate the comment posted via XML-RPC. Also, it doesn’t seem to affect the commenting capabilities of WP when using a Web browser.
I’m not a WP hacker, so, maybe I have missed something. But I still get the feeling that something is going wrong, and I wanted to check here before submitting a bug on the WP bug tracker.
http://codex.wordpress.org/Reporting_Bugs
TIA
Cheers
-Emmanuel
- The topic ‘wp.newComment (XML-RPC) bug?’ is closed to new replies.