WordPress.org

Ready to get started?Download WordPress

Forums

Achievements for WordPress
[resolved] Display total amount of points (7 posts)

  1. RLL18
    Member
    Posted 11 months ago #

    First, I want to say that I LOVE your plugin!

    Next, I want to know how to display a total number of karma points a person has earned on the /members/USER/achievements page?

    For example it shows:

    Achievement 1 5 karma points description
    Achievement 2 2 karma points description

    7 total karma

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

  2. RLL18
    Member
    Posted 11 months ago #

    The reason I want this is because I may manually award points. Points that aren't gained through achievements...

  3. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 11 months ago #

    The dpa_user_points() function will print the number of karma points a user has.

  4. RLL18
    Member
    Posted 11 months ago #

    I'm not 100% familiar with coding. I type just that piece of code where I want it and it will work?

    I have tried in several different files both with <php> coding as well as stand alone, and I haven't been able to get it to work how I want it. I want it to display a total number of points earned on the table that shows the acheivements earned (either at the top or bottom). Can you help me with the file that I need to add the code to?

    My ultimate goal is to have the table located on the achievements page look like this:

    achievement >> karma points >> description
    achievement >> karma points >> description
    achievement >> karma points >> description
    Total achievements completed >> total karma points earned

    Oh, and thank you for the response!!

  5. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 11 months ago #

    Because the results can be paginated, do you want to overall total karma points number, or just add the karma points together for the displayed results?

  6. RLL18
    Member
    Posted 11 months ago #

    overall total karma points. I would like it to be displayed in the acievements table.

  7. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 11 months ago #

    I can't walk you through customising the templates step-by-step (if you're not familiar with PHP and WordPress development/theming, it could be tricky), but basically you need to do this:

    1) Copy /plugins/achievements/templates/achievements/achievements/loop-achievements.php to /themes/YOUR_THEME/achievements/loop-achievements.php

    1) Copy /plugins/achievements/templates/achievements/achievements/loop-single-achievement.php to /themes/YOUR_THEME/achievements/loop-single-achievement.php

    2) Open the new loop-achievements.php in a text editor, and add a new column to the table (the th elements).

    3) Open the new loop-single-achievement, and add in the new cell (td, this time). For the value, use the dpa_user_points() function to print the row's user's points total, something like this: <td><?php dpa_user_points(); ?></td>.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.