"People Who Have Earned This" not populating
-
I have badgeos, badgestacker, and buddy press installed on my WordPress site, lhcsdbadges.org. When I create badges, I check the box that says “Yes, display a list of users who have earned this achievement.” On the front end when you look at each badge, there is text that says “People who have earned this:” but nothing is populating there, even though that particular badge has been earned by a few users. Do I need to check something else, or do I I need to also include a shortcode on the page?
Thank you!
-
From the looks of it, using the LHCSD 101 achievement as an example, it is finding some people who have earned achievements, but it’s failing at the following snippet of code for the output:
$user_content = '<li><a href="' . get_author_posts_url( $user->ID ) . '">' . get_avatar( $user->ID ) . '</a></li>';
It is generating a link, but the link is leading to a 404 page, and it’s not outputting an avatar.
While I’m not sure what’s going on with the avatar part and your users, I do know there’s the bp_core_get_user_domain() function that could be used to generate the link, if you’re in BuddyPress.
We also have this WordPress filter for the output of individual users within this output,
$output .= apply_filters( 'badgeos_get_achievement_earners_list_user', $user_content, $user->ID );
Not sure how developer inclined you are, so let me know if you need an example or some sort of help with potentially changing the output per-user.
Michael,
Thank you so much for getting back to me. I’m very much not developer inclined. I’ve poked around at the code but I’m not sure where anything goes and I really don’t want to jack up all the work I’ve already put into this. However, I do need for the site to show a list of people who have achieved the badges for each badge I have available (and there will be more). I’d appreciate any help you can possibly provide!
Jody
Hopefully the site is a dev site, because I don’t want to needlessly risk breaking a live working site.
Try out this quick custom plugin I did up for you. It’ll hopefully take care of all of the changes needed for this, and if anything, it’d just get it added for you for us to further debug/tinker with.
It’s actually a working site with about 35 users right now. I use bluehost and I’ve had to delete plugins through bluehost before when one completely crashed my site, so I can do that if necessary. Do I risk it? 🙂
Michael,
I installed the plugin, but nothing happened to the output.
Jody
Try this one: https://cloudup.com/cGuTzwyLPgl
I realize I originally thought I had more information than I did with regards to the user.
Michael,
This time, the plugin failed to install. Is that an error on my part?
Jody
Wait– it is. I have to remove the destination folder first. I’ll do that and let you know.
Hooray! You are awesome– thank you so much! I have one more question– Is there a way to change the output source so it displays the user’s first name instead of their username?
I really, really appreciate your help.
You’ll need to edit the plugin to reference “first_name” for the link text instead of “user_login”.
Other than that, good to see it’s working now and providing valid links.
- The topic ‘"People Who Have Earned This" not populating’ is closed to new replies.