Opened 3 years ago

Last modified 2 years ago

#13835 reopened feature request

XLM-RPC API should return commentmeta values

Reported by: djr Owned by: josephscott
Priority: low Milestone: Future Release
Component: XML-RPC Version: 2.9
Severity: minor Keywords: has-patch needs-testing
Cc: djr, n.prasath.002@…

Description

This ticket is a follow up on my Twitter and subsequently email conversation with Joseph Scott (josephscott) about the new commentmeta table in WordPress 2.9 and the XML-RPC API. We use the plugin Feature Comments (http://wpprogrammer.com/feature-comments-wordpress-plugin/) for hiding or featuring certain comments. The plugin stores either a value of 'Buried' or 'Featured' in the commentmeta table and uses these values to append a css class to comment_class.

I'd love to retrieve these commentmeta values (buried/features) through the XML-RPC API (which we use) with wp.GetComment or wp.GetComments, so we're able to programmatically hide or feature these comments in our own iPhone app.

Please note this is a specific example, but my request should I no way be seen as a private request. I think the commentmeta in 2.9 was a great addition for stuff like Twitter usernames, mood, gender, and so forth. I hope we're able to retrieve these values programmaticaly through the API as well.

Attachments (1)

getcommentmeta.diff (462 bytes) - added by nprasath002 2 years ago.

Download all attachments as: .zip

Change History (13)

comment:1   djr3 years ago

  • Severity changed from normal to minor

comment:2   djr3 years ago

  • Version set to 2.9.2
  • Keywords needs-patch added; xml-rpc commentmeta api removed
  • Milestone changed from Unassigned to Future Release
  • Version changed from 2.9.2 to 2.9
  • Cc n.prasath.002@… added
  • Keywords has-patch added; needs-patch removed
  • Keywords needs-patch added; has-patch removed

That patch won't work.

get_comment_meta() takes in more than just the comment id. You also need to specify the key you're retrieving. Here's the full function from the source:

function get_comment_meta($comment_id, $key, $single = false) {
    return get_metadata('comment', $comment_id, $key, $single);
}

$single is optional (and not needed in this case), but $key is not. At the very minimum, you'd have to loop through and get all the keys so you could retrieve all the comment meta.

  • Keywords has-patch needs-testing added; needs-patch removed
  • Version changed from 2.9 to 3.1

Scratch that, apparently you can leave $key blank to have the function return everything. Looks good.

comment:7 follow-up: ↓ 8   aaroncampbell2 years ago

  • Version changed from 3.1 to 2.9

Please don't change the version on the ticket. The version is used to track the version when the error first occurred.

comment:8 in reply to: ↑ 7 ; follow-up: ↓ 9   ericmann2 years ago

Replying to aaroncampbell:

The version is used to track the version when the error first occurred.

Considering this is a feature request and not a bug fix, should we be patching and reporting against trunk? It's not an error ... but a requested API enhancement for a feature introduced in 2.9.

comment:9 in reply to: ↑ 8   nacin2 years ago

Replying to ericmann:

Considering this is a feature request and not a bug fix, should we be patching and reporting against trunk?

Yes, always patch against trunk.

It's not an error ... but a requested API enhancement for a feature introduced in 2.9.

The version field is for the earliest applicable version of a report. Generally for bugs, but works for enhancements just fine too. Version 2.9 is appropriate here as that's when commentmeta came into play.

  • Resolution set to fixed
  • Status changed from new to closed

THe documentation for get_comment_meta is not complete as the key value and the boolean is optional.
i created a ticket for that here
http://core.trac.wordpress.org/ticket/16965

Also i normally test with a java client and print to see whether i,m
getting the expected results
should i removed needs testing??

P.S - i,m nt getting any updates about this ticket via email. how can i do that

  • Resolution fixed deleted
  • Status changed from closed to reopened

P.S - i,m nt getting any updates about this ticket via email. how can i do that

Ensure your email is listed in the preferences and check the CC box when making a reply.

Note: See TracTickets for help on using tickets.