We don’t presently have a widget that displays the achievements for the user of a given profile, to be honest. So something for that would need to be custom done.
Thread Starter
Xyun
(@xyun)
:C Well, Thanks for the quick response, Michael.
I will try to create something, with the knowledge that I have.
Regards.
Not sure if you are on BuddyPress or something else, but example two from http://trexthepirate.com/badgeos/2014/12/show-off-users-achievements-part-one/ should outline the necessary parts for the achievement querying Just need to switch out a way to provide the displayed user ID, if not BuddyPress.
Should help with a basis to work from.
Thread Starter
Xyun
(@xyun)
Thank you Michael, hours trying but and i have not gotten it to work
Im not using buddypress in my site, just wordpress
I have not gotten a proper tag to replace: “bp_displayed_user_id” to return the user ID of the user whose profile you are viewing
What other plugin/setup are you using for creating the profiles? There must be some variable/ID somewhere during the process of the page generation that you can use, because it’s querying for the specific user somehow.
Thread Starter
Xyun
(@xyun)
Good Morning, Michael, i use ForumEngine Plugin in my site.
i found this:
get_header();
global $wp_query, $wp_rewrite, $post,$current_user;
$author = get_user_by( 'slug', get_query_var( 'member' ) );
$edit_link = add_query_arg( 'uid', $author->ID , et_get_page_link('edit-profile') );
$user_location = get_user_meta($author->ID,'user_location',true);
Tried this code but still doesn’t work:, keep showing my badges.
$achievements = badgeos_get_user_achievements( array( 'user_id' => get_user_by( 'slug', get_query_var( 'member' ) ) ) );
Closer, but not quite there yet.
$author = get_user_by( 'slug', get_query_var( 'member' ) );
$achievements = badgeos_get_user_achievements( array( 'user_id' => $author->ID ) );
That should work as it’ll query for any badges associated with the current displayed author. After that, unless I missed some detail, you should be rollin’ along.
Thread Starter
Xyun
(@xyun)
Yeah! it works, Thank you Michael, you are the best 🙂