The recent tab in My Sites does not work for a user other than an administrator

Issue

  • After upgrading from DXP 7.0 to DXP 7.4, users with roles other than administrator are not able to see the recent sites in the recent tab in the "My Sites" section.

Environment

  • Liferay DXP 7.2
  • Liferay DXP 7.3
  • Liferay DXP 7.4

Resolution

  • The current behavior is expected and was introduced by LPS-97367. Currently, the recent site navigation is dependent on the user's personal bar being present in the theme of a site. If a developer does not want to add the user's personal bar ( <@liferay.user_personal_bar />) to the theme, then the site will not show up in the "recent" site navigation.
  • The effort to change the current behavior is high as it would require an important refactor and would not provide that much value. Also, there was no intent in the code to have it work apart from navigating using the site's menu. 
  • There is a possible solution to resolve the current issue by customizing the code. The following information is only a tip on how to implement the customization and is meant for your Developer Team to apply at your own discretion. Customization is not compatible with Liferay Support:

You create and embed a custom portlet that will call the necessary code to add a site to the Recent Sites list where necessary. Steps for portlet creation can be found here:Using MVCand steps for embedding a portlet to a theme can be found here:Embedding Portlets in Themes. The created portlet needs to call the following code on render:

_recentGroupManager.addRecentGroup( _portal.getHttpServletRequest(renderRequest), themeDisplay.getScopeGroupId());
Then embedding the portlet into the theme should be sufficient to cause the page to show up in recent sites. 

This portlet would be similar to the currentproduct-navigation-user-personal-webportlet. So one way you could go about this is to copy that portlet and remove everything except the part that’s necessary to call_recentGroupManager.addRecentGroup

You’ll be left with a very simple almost empty portlet that is simply calling a method on render to add the current site to the recent sites list. You could then choose to embed that portlet in a theme using the <liferay-portlet:runtime > tag to embed the portlet in your theme.

If you require assistance with the customization, we recommend reaching out to our GS (Global Services) for further help and consultancy.

¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0