WordPress.org

Ready to get started?Download WordPress

Forums

Achievements for WordPress
Number of Achievements Earned in a Category (9 posts)

  1. pmcvicker
    Member
    Posted 1 year ago #

    Greetings,

    I was wondering if anyone here could help me out with a custom function for Achievements. With the introduction of achievement categories in the latest update, I'd like to output a live count of how many achievements total have been unlocked across all users within a given category. I'd like to include the count under the category names on this custom page: http://challengebeta.mypcls.org/challenges/ .

    Any help anyone could offer would be greatly appreciated.

    http://wordpress.org/extend/plugins/achievements/

  2. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Can you show the code you're using to build the category list on your page at the moment?

  3. pmcvicker
    Member
    Posted 1 year ago #

    Hey Paul,

    I put this page together from scratch, rather than dynamically pulling in available categories. The previous plugin I was using was too slow at loading data for the 150+ achievements I have. An example for one of the categories (art) is:

    <li>
    <div class="item-avatar"><a href="http://challengebeta.mypcls.org/challenges/art-challenges/"><img class="avatar group-6-avatar avatar-150 photo" title="Art" alt="Group logo of Art" src="http://challengebeta.mypcls.org/wp-content/uploads/group-avatars/6/845c924e6b03ada716fb49d6fbdb43a8-bpfull.jpg" width="150" height="150" /></a></div>
    <div class="item">
    <div class="item-title groups-directory-title"><a href="http://challengebeta.mypcls.org/challenges/art-challenges/">Art</a></div>
    </div>
    <div class="clear"></div></li>
  4. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    :(

    If you construct the list dynamically with get_categories, I think it returns the count for each object. See "List Categories and Descriptions" on http://codex.wordpress.org/Function_Reference/get_categories

  5. pmcvicker
    Member
    Posted 1 year ago #

    Will that return a count of how many achievements exist within a given category or how many have been earned by users?

  6. pmcvicker
    Member
    Posted 1 year ago #

    Although, thinking back on my last look at how progress is being recorded, achievement unlocks are "posts" in a loose sense, and in this way they'd apply towards the count?

  7. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    > Will that return a count of how many achievements exist within a given category
    This.

  8. pmcvicker
    Member
    Posted 1 year ago #

    Ah, what I'm looking for is a count of how many users have earned a particular achievement, and beyond this, how many have been earned in a whole category. Such as: "237 users have unlocked achievements in the Art category."

    I see that dpa_progress is the post-type with a post-status of dpa_unlocked that is registering completion.

    So I guess what I'm looking for is a way to query all of the posts of dpa_progress type which have dpa_unlocked status within a specific category and output that as a number.

  9. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Unfortunately, this is non-trivial and not something I have figured out before which I can post on.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.