Forum Discussion
page.context.user?? && page.context.user.id??
- iftomkins11 years agoMaven
Perfect! That worked, thanks. The main issue was that when you're on the mobilemykudospage, any use of page.context.user.id throws an error. The below code (included below), avoids that.
Screenshot of tabs on user's own profile page: http://screencast.com/t/pFPw7URGR
Screenshot of tabs on someone else's profile page: http://screencast.com/t/AuxUgKJ3
<#-- Displays profile tabs: posts, kudos, and bio. If a user is viewing someone else`s profile page, the Kudos tab is hidden. -->
<ul class="profile-tabs">
<#if page.context.user?? && page.context.user.id?? >
<li class="tab-activity">
<a href="/t5/user/viewprofilepage/user-id/${page.context.user.id}/tab/activity">${text.format('general.Posts')}</a>
</li>
<#if user.id == page.context.user.id> <#-- Only show Kudos tab on your own profile page -->
<li class="tab-votes">
<a href="/t5/kudos/mobilemykudospage">${text.format('text.UserRankNodeEditor.kudos.title')}</a>
</li>
</#if>
<li class="tab-bio">
<a href="/t5/user/viewprofilepage/user-id/${page.context.user.id}/tab/bio">${text.format('taplet.commonComponents.nodeDescription.title')}</a>
</li>
<#else>
<#if page.name?lower_case == "mobilemykudospage" >
<li class="tab-activity">
<a href="/t5/user/viewprofilepage/user-id/${user.id}/tab/activity ">${text.format('general.Posts')}</a>
</li>
<li class="tab-votes">
<a href="/t5/kudos/mobilemykudospage ">${text.format('text.UserRankNodeEditor.kudos.title')}</a>
</li>
<li class="tab-bio">
<a href="/t5/user/viewprofilepage/user-id/${user.id}/tab/bio">${text.format('taplet.commonComponents.nodeDescription.title')}</a>
</li>
</#if>
</#if>
</ul>
Related Content
- 2 months ago
- 11 years ago