From themeDisplay we will get the loggedIn User Details ,Suppose we want get the User Details based upon user page.
For example : Profile portlet (user A logged In and need to see the User B profile details in User B profile page)
//ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute( WebKeys.THEME_DISPLAY );
Group group = themeDisplay.getScopeGroup();
if (group.isUser()) {
User user = UserLocalServiceUtil.getUser(group.getClassPK());
}
For example : Profile portlet (user A logged In and need to see the User B profile details in User B profile page)
//ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute( WebKeys.THEME_DISPLAY );
Group group = themeDisplay.getScopeGroup();
if (group.isUser()) {
User user = UserLocalServiceUtil.getUser(group.getClassPK());
}