WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] count_user_posts function not counting co-authors (12 posts)

  1. agomendes
    Member
    Posted 2 years ago #

    How we can fix the result of wordpress count_user_posts function? We just have results for authors. Nothing is being counted for co-authors. Any idea to bypass this issue?

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. agomendes
    Member
    Posted 2 years ago #

    Any idea to fix this issue? This is a bit urgent because all posts that were written by two authors are not being counted to the co-author. The people are claiming with some reason.

    Many thanks for your help and support.

  3. agomendes
    Member
    Posted 2 years ago #

    Nothing?! I really need to fix this.

  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Sorry, I'll take a look at this when I have a moment

  5. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    I did some testing on this and partially confirm the results but not entirely.

    When I first activate the plugin, the results produced by count_user_posts() are inaccurate. Co-authors are actually stored as terms under the 'author' taxonomy. Their post count is the 'count' column in the term_taxonomy table. I think our activation script isn't up to par and these post count values aren't properly updated until the post is saved again.

    Could this explain what you're seeing, or can you clarify further with how your data is inaccurate?

  6. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    @agomendes Any chance you could provide screenshots too? Thanks

  7. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Improved how user post counts are calculated in this ticket. Improvements will be available in v2.6.

    If you have screenshots to indicate where you're getting stale numbers, it would be great for ensuring what I've committed fixes your problem.

    Thanks!

  8. Ryan Imel
    Member
    Posted 2 years ago #

    Thanks for the 2.6 update, Daniel. I really like this plugin and hope to start using it soon. Right now this post count issue is the only thing holding me back.

    So the problem I run into is that once active, the post counts on my author templates are only counting those posts where the author is a co-author. So without the plugin active, my own author template looks like this: http://cl.ly/1D2n1H3D0H2v1e3l1U1B but after activation it looks like this: http://cl.ly/3C2H0X1h2f2I3t3v3d30. My author archive itself is http://wpcandy.com/author/ryanimel.

    Right now I'm using this in the template: https://gist.github.com/1514035

    Hope that helps -- if there's other information you'd like to have to debug it, just let me know.

  9. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Thanks Ryan. This should actually be fixed in v2.6 because we're filtering the function. You can also use count_user_posts().

    If the number appears inaccurate, can you go to a post where you're an author or co-author, hit update, and see if the post count is changed?

  10. Ryan Imel
    Member
    Posted 2 years ago #

    Ah, fantastic Daniel, thanks. I should have thought to update a post so the filter can run. That issue's fixed for me, and I'm happily using it now :)

  11. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 2 years ago #

    Awesome, glad to hear it works :)

  12. agomendes
    Member
    Posted 2 years ago #

    Sorry for this late answer. Now it’s working like a charm.

    Daniel, Thanks for your support and effort.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic