Forums

Home » Liferay Social Office

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Leigha Wilson
Embed Social Office Dashboard button in Navigation
November 6, 2013 2:08 PM
Answer

Leigha Wilson

Rank: New Member

Posts: 4

Join Date: June 17, 2013

Recent Posts

A client of mine is looking to have a button that links to the Dashboard of Social Office for the user logged in. I have no problem getting the button into the navigation but I can't seem to find a way to embed that link code in there so the button takes the user to the correct place.

I haven't been able to find anyone doing this. I know is a little wonky that they want the same button that is already in the admin bar also to be in the navigation. The admin bar is actually hidden from there users, so they need this button to be in the navigation.

Please let me know if anyone has any pointers. Thanks in advance!
Anonymous
RE: Embed Social Office Dashboard button in Navigation
November 6, 2013 5:20 PM
Answer

Anonymous

Hey Leigha,

You can link to the current user's profile url by adding /user/ to the home url: http://www.liferay.com/user/ ; the only caveat is that it doesn't present a consistent url if you're browsing within a portlet.

Alternatively, you can produce a user's url from within the theme:
1#set ($user_local_service = $serviceLocator.findService("com.liferay.portal.service.UserLocalService"))
2#set ($current_user = $user_local_service.getUserById($page_group.getClassPK()))
3#set ($current_user_profile_url = $theme_display.getURLPortal() + $theme_display.getPathFriendlyURLPublic() + "/" + $current_user.getScreenName())
Leigha Wilson
RE: Embed Social Office Dashboard button in Navigation
November 8, 2013 12:53 PM
Answer

Leigha Wilson

Rank: New Member

Posts: 4

Join Date: June 17, 2013

Recent Posts

Awesome! Thank you so much for your help.

I ended up doing something a little different, just because of what my client needed.

My ending code:
#set ($user_id = $user.getUserId())
#set ($current_user = $user_local_service.getUserById($user_id))
#if ($is_signed_in)
<li class="lfr-nav-deletable lfr-nav-updateable">
<a href="/user/$current_user.getScreenName()/so/dashboard" target="_blank" class="sf-with-ul">Dashboard</a>
</li>
#end