ArashDev Posted July 13, 2023 Posted July 13, 2023 hi I use the following code to display user achievements in AuthorPan, and everything works fine. <h4 class="user_badgetitle_lines">Badges</h4> <div class="badge"> {{if \IPS\core\Achievements\Badge::show() AND \IPS\core\Achievements\Badge::getStore()}} {{if $comment->author()->badgeCount()}} <ul class="ipsCaterpillar ipsMargin_left"> {{foreach $comment->author()->recentBadges( 3 ) as $badge}} <li class="ipsCaterpillar__item"> <span class="ipsPos_relative"> {$badge->html('ipsFlex-flex:00 ipsDimension:3', FALSE, TRUE)|raw} </span> </li> {{endforeach}} </ul> {{endif}} {{endif}} </div> I want to place an icon that, when clicked, allows users to view each other's Badges, so I used below codes: <span class="items"> <a href="#" data-ipstooltip _title='more badges' data-ipsDialog data-ipsDialog-title="{{if $comment->author()->member_id === \IPS\Member::loggedIn()->member_id}}{lang='profile_achievements_overview_self'}{{else}}{lang='profile_achievements_overview' sprintf='$comment->author()->name'}{{endif}}" data-ipsDialog-content="#user_badge_list"><i class="fa fa-ellipsis"></i></a> </span> <!--modal--> <div id="user_badge_list"> {{if \IPS\core\Achievements\Badge::show() AND \IPS\core\Achievements\Badge::getStore()}} {{if $comment->author()->badgeCount()}} <ul class="ipsCaterpillar ipsMargin_left" data-action="badgeLog"> {{foreach $comment->author()->recentBadges( NULL ) as $badge}} <li class="ipsCaterpillar__item"> <span class="ipsPos_relative"> {$badge->html('ipsFlex-flex:00 ipsDimension:3', FALSE, TRUE)|raw} </span> </li> {{endforeach}} </ul> {{endif}} {{endif}} </div> <!---</>---> My problem is that when I click on the icon, instead of showing my own badges, it displays other user's badges for me, and vice versa.
Management terabyte Posted July 15, 2023 Management Posted July 15, 2023 Try updating the user_badge_list ID to use a unique value. The code you're using right now will add that same ID multiple times on the page (based on the number of posts). You could try appending the ID of the post for example. ArashDev 1 Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! >
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now