#10510 closed defect (bug) (fixed)
XMLRPC wp.getComments 'spam' status returned as 'hold'
Reported by: | nigelgos | Owned by: | josephscott |
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.8.1 |
Component: | XML-RPC | Keywords: | XMLRPC getComments status spam |
Focuses: | Cc: |
Description
When requesting spam messages the status is returned as 'hold'. This means you can't differentiate between comment statuses when you ask for 'spam' and 'hold' comments to be returned.
It does return the correct comments, just the status is wrong.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
I'm able to reproduce this.
After looking through the path for the comment status it turns out that it is the value comparison checking in the wp_getComment function that was causing the confusion:
The comment approved field is a string. This was tripping up comments with 'spam' status and indicating that there were 'hold'. By quoting the numeric comparisons for the zero and one values the conditional checks work as expected. After making this change my tests show that the XML-RPC method wp.getComment (and wp.getComments) return the correct status values of hold, approve and spam.
I've attached a diff to make this change.