WordPress.org

Ready to get started?Download WordPress

Forums

Achievements for WordPress
[resolved] Sort Achievements (9 posts)

  1. joejozwowski
    Member
    Posted 1 year ago #

    Is there anyway to modify the sort of the achievements?

    I have copied the loop-achievements.php and loop-single-achievements.php into my theme folder and am making modifications there.

    I would like to sort my achievements from Lowest Karma Points to Highest Karma Points.

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

  2. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    I think you need to find the call to dpa_has_progress() in the templates, and pass these extra parameters:

    'orderby' => 'meta_value_num',
    'meta_key' => '_dpa_points'

  3. joejozwowski
    Member
    Posted 1 year ago #

    I found TWO files with the title "template.php"

    ONE in acheivements>>includes>>achievements
    One in achievements>>includes>>progress

    Which one do I modify?

  4. joejozwowski
    Member
    Posted 1 year ago #

    it also looks like there is already a call for the 'orderby' and is set as follows:
    'orderby' => 'date'
    Do I just modify this line to read:

    'orderby' => 'meta_value_num'

  5. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    You should never modify a plugin's files, it will make upgrades much harder for you in the future. I'll look back when I get time with some guidance on what files to copy to your theme, which you can then tweak.

  6. joejozwowski
    Member
    Posted 1 year ago #

    This I know....
    I wanted to know which file to copy into my theme folder with the proper modifications.

  7. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Copy /achievements/templates/achievements/achievements/content-archive-achievements.php into /wp-content/themes/YOUR_THEME/achievements/

    Then edit that copy, and adjust the dpa_has_achievements() call which is not too far from the top of the file.

  8. stwc
    Member
    Posted 11 months ago #

    For others who are as limited in their self-taught PHP as me, Paul means (or at least I think he does, but it worked for me), that the line

    <?php if ( dpa_has_achievements() ) : ?>

    in that template becomes

    <?php if ( dpa_has_achievements(array('orderby' => 'meta_value_num')) ) : ?>

    Took me a while to figure that out.

  9. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 11 months ago #

    Yep! Thanks stwc

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic