Forum Replies Created

Viewing 1 replies (of 1 total)
  • Firstly, excellent post. I had a similar problem with a few variations and struggled to get up to speed myself with everything. Finally came to a similar conclusion, details here:

    Problem: I want the BadgeOS badges to appear in the automated BuddyPress ‘Members’ page.

    Issues I experienced when working through the comments and my solutions:

    1)

    I am trusting you will be fine with copying the necessary template files, from this plugin you reference, into your own theme for safekeeping. So I won’t go over that part.

    – I didn’t understand from this that I needed to copy the Members directory from the BuddyPress plugin directory to my Theme’s directory. This meant I was working on the wrong members-loop.php file. Further information about this here: https://codex.buddypress.org/themes/theme-compatibility-1-7/

    2)
    I used the function created by Michael but I kept getting some form of error – “Parse error: syntax error, unexpected ‘$args’ (T_VARIABLE) in…”. Debugged in Dreamweaver ok, realised it was a ‘space’ on every empty line. Once I deleted them it worked fine. Also I didn’t need the initial ‘<php’ tag as my functions.php already had one and it seems I needed to use it. I placed the function at the bottom of the document.

    3) I finally got it ‘working’ only to realise that it gave the achievement of the logged in user rather than each users specific achievements. I only wanted 1 badge to show (my badge types are called ‘rank’) and I had to use bp_get_member_user_id() for the users. I finally managed to tweak X-Raym’s echo to the following:

    <?php echo custom_badgeos_user_achievements_list(array('user' => bp_get_member_user_id(), 'type' => 'rank', 'limit' => 1));?>

    4) I wanted the latest badge to show from one type of achievement but the function always returned the first badge. Rather than rewrite the function to incorporate some form of descending sort, I am using a workaround where I revoke old ranks so only one exists for any user (actually more useful to me anyway).

    5) I just need to format it now. Hoping to use the following forum for help (they directed me to the hyperlink in point 1): https://premium.wpmudev.org/blog/how-to-create-a-custom-buddypress-members-directory/

    Cheers to both Micahel and X-Raym. I’m not one for contributing to forums like this but as the posts are so recent and so helpful I thought the time has come to share.

Viewing 1 replies (of 1 total)