Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    You’re going to need to fetch them all and output them via a hook around the avatar. I don’t know what’s available there at the moment.

    I recommend using this function for fetching the actual achievement data: https://badgeos.org/api/source-function-badgeos_get_user_achievements.html#12-66

    Thread Starter ian.izaguirre001

    (@ianizaguirre001)

    So I just copy and paste that in my child functions php ?

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    You’re going to need to use that function to fetch the user’s data, and then use the results to construct your list of achievements. Once that’s done, you need to figure out the hook necessary to output that list below the avatar. I don’t know what hook that is offhand.

    Michael, thanks for this great plugin!

    Is there any chance you could help us with some more specific directives on how to pull the badges in under somebody’s avatar in their activity in the forums? This is critical to me but I don’t know enough about how to implement it. Here’s an example screenshot:

    https://imgur.com/klOhIhg

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    For clarification, I am not the original developer nor owner. Just a busy bee helping support it and develop it as part of a team.

    At this point, the output location is not controlled by BadgeOS or BadgeOS Community Addon. It’s all bbPress or built-in BuddyPress forums, depending on how old your install is.

    If your forums are bbPress powered at the moment, this should work and get you into the right area:

    function append_badges_via_filter( $author_link = '', $args ) {
    
    	# Needed to get the user ID of the person intended to be displayed.
    	$user_id = bbp_get_reply_author_id( $args['post_id'] );
    	#Construct your output here.
    	$badge_output = '';
    
    	return  $author_link . $badge_output;
    }
    add_filter( 'bbp_get_reply_author_link', 'append_badges_via_filter', 10, 2 );

    You’ll want to return the $author_link content first and then your achievement output so that it is still displayed properly on the left of the reply.

    Just need to use previous information on actually creating the output. For an in-depth article about various ways to use the aforementioned badgeos_get_user_achievements function, you can check out https://trexthepirate.com/badgeos/2014/12/show-off-users-achievements-part-one/ which I wrote up last night.

    I haven’t looked deep into the BuddyPress code if you’re using that for the forums, and I’d have to go poking through it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I get badges to appear under users avatars in forum topics?’ is closed to new replies.