WordPress.org

Ready to get started?Download WordPress

Forums

BadgeOS Community Add-on
[resolved] Showing all achievements in profile (2 posts)

  1. wedgetalon
    Member
    Posted 8 months ago #

    I'm trying to modify this plugin to show ALL achievements on the achievements tab in a user's profile. I then intend to use CSS to highlight the ones that user has actually earned. I've almost got it working.

    In this plugin's bp-members.php, I edited the function bagdeos_bp_member_achievements_content to use the following attributes when echoing badgeos_achievements_list_shortcode:

    $atts = array(
    	'type'        => 'all',
    	'limit'       => '100',
    	'show_filter' => 'true',
    	'show_search' => 'false',
    	'group_id'    => '0',
    	'user_id'     => bp_displayed_user_id(),
    	'wpms'        => badgeos_ms_show_all_achievements(),
    );

    This works to display all the achievements, but the problem now is that the badges seem to be given the "user-has-earned" or "user-has-not-earned" css classes based on the VIEWER'S user id rather than the PROFILE'S user id.

    Any hint as to what I'm missing?

    http://wordpress.org/plugins/badgeos-community-add-on/

  2. Michael Beckwith
    Member
    Plugin Author

    Posted 8 months ago #

    Honestly, it's not a good idea to be editing plugins like that, as you'll have to re-apply the edits each time an update is pushed out.

    From the looks of the source code, bagdeos_bp_member_achievements_content() is simply a callback function that is attached to the bp_template_content action.

    You very likely could unhook the default one, if you so desire, and add your own that is simply a copy of the original function, with your edits. This would go in your theme folder so that it doesn't get overwritten by future plugin updates.

    Can't say I can offer a lot of help for that level of customization, but I'm not afraid to throw out ideas to you. I am definitely going to encourage finding a way to not be editing the plugin directly though.

    That said though, it looks like it ends up using badgeos_achievements_list_shortcode() which is a function used with the available shortcodes, and doesn't offer a filter for the arguments. It simply grabs the global $user_ID, which, at the end of the day, would indicate that this may not be the best function to use for your use case.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.