marina_ls Posted March 7, 2019 Posted March 7, 2019 Hi there, Could anyone explain me why I can't get the member's rank using this code in mobileNavigation template? <div id='elUserNav_mobile-1b' class='ipsList_inline signed_in ipsClearfix'> <ul id='elUserNav_mobile-2' class='ipsList_inline signed_in ipsClearfix'> <li id='cUserLink'> <a href='{member="url()"}' id='elUserLinkb'> {{if isset( $_SESSION['logged_in_as_key'] )}}{lang="front_logged_in_as" sprintf="$_SESSION['logged_in_from']['name']"} {{endif}}{member="name"} </a> </li> <li id='cUserRankcs'><p class='ipsType_reset ipsType_medium'>{$member->rank['title']}</p></li> </ul> </div> {$member->rank['title']} works well in other templates like hovercard or profileHeader... Thanks in advance!!
Adriano Faria Posted March 7, 2019 Posted March 7, 2019 There's no $member variable in that template. You have to pick the loggedin user. You can do something like that: {{$rank = \IPS\Member::loggedIn()->rank['title'];}} and then add in the <li>: <li>{$rank}</li>
marina_ls Posted March 7, 2019 Author Posted March 7, 2019 hey @Adriano Faria ! Thanks for the solution! However, I did it and the editor says that there is an error in the code and I can't save the template. I'm missing something here? <a href='{member="url()"}' id='elUserLinkb'> {{if isset( $_SESSION['logged_in_as_key'] )}}{lang="front_logged_in_as" sprintf="$_SESSION['logged_in_from']['name']"} {{endif}}{member="name"} </a> </li> {{$rank = \IPS\Member::loggedIn()->rank['title']}} <li id='cUserRankcs'><p class='ipsType_reset ipsType_medium'>{$rank}</p></li> </ul>
marina_ls Posted March 7, 2019 Author Posted March 7, 2019 1 minute ago, Adriano Faria said: I edited my post to add ; Adriano, it worked like a charm. Thanks A LOT!!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.