Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#16608 closed enhancement (invalid)

Adding an xml-rpc call to get the count of spam comments

Reported by: plopmaster Owned by:
Priority: normal Milestone:
Component: XML-RPC Version: 3.0.5
Severity: normal Keywords: close
Cc:

Description

I made a patch to add an xml-rpc call to get the count of comments in various status (spam, approuved, ...)
The call is name wp.getCommentsStatusCount

Attachments (2)

01-xmlrpc-add-wp.getCommentsStatusCount.patch.gz (733 bytes) - added by plopmaster 2 years ago.
01-xmlrpc-add-wp.getCommentsStatusCount.patch (1.4 KB) - added by ericmann 2 years ago.
Real patch file.

Download all attachments as: .zip

Change History (9)

As much as I like compression, you can't read a gzipped file in Trac.

And I just realized that right-clicking and saving the patch file saves the HTML output of the Trac ticket instead ... uploading the real patch in a readable format ...

Last edited 2 years ago by ericmann (previous) (diff)

Real patch file.

  • Keywords needs-refresh added

Two things:

  1. What version of WordPress is this patched against? Since it's a patch on xmlrpc.php and not wp-includes/class-wp-xmlrpc-server.php I'm guessing you're not using the latest version (also apparent in your "since 2.7.0" note). Please patch against the current version of WP.
  2. Why do you accept a fourth parameter for status, but hardcode "status=spam"?
  • Keywords close added; needs-refresh removed

Comment count function in xml-rpc has been added since 2.5.0

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

There is already an XML-RPC method to get this data: wp.getCommentCount( blog_id, username, password, <post_id> )

The post_id parameter is optional, if it is left off it will give you the comment count totals for the entire site. If you provide it the counts will be just for that post. The counts are broken down by comment status, results look like this:

    [approved] => 31
    [awaiting_moderation] => 2
    [spam] => 2
    [total_comments] => 35
  • Milestone Awaiting Review deleted

@ericmann :

1/ I use the latest version of WP. But I indeed lack of knowledge on WP programming...

2/ Bug in the patch :)

@josephscott : so, documentation (http://codex.wordpress.org/XML-RPC_wp#wp.getCommentCount) is lacking this precision ...

Thanks for the help :)

Note: See TracTickets for help on using tickets.