Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-66708

layoutTypePortlet.removePortletId is not working in PostLoginHook

Details

    • Bug
    • Status: Verified
    • Resolution: Unresolved
    • 6.2.5 CE GA6
    • None
    • None
    • 3
    • Ubuntu LTS 14.04
    • Oracle Sun JDK 7
    • GlassFish 4.0
    • MySQL 5.7

    Description

      In a postLogin Hook, trying to remove all opened portlets using the following code:

       user = UserLocalServiceUtil.getUserById(userId);
                       long privatePlid = user.getGroup().getDefaultPrivatePlid();
                       Layout layout = LayoutLocalServiceUtil.getLayout(privatePlid);
                       LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout
                               .getLayoutType();
                       List<String> portletIds = layoutTypePortlet.getPortletIds();
                       for (String portletId : portletIds) {
                           layoutTypePortlet.removePortletId(userId, portletId);
                       }
                      LayoutLocalServiceUtil.updateLayout(layout.getGroupId(),
                              layout.isPrivateLayout(), layout.getLayoutId(),
                              layout.getTypeSettings());
      
      

      However no portlet removed, and the layout still the same.

      Liferay 6.2 deployed on glassfish 4, and java version 1.7.0_79

      Attachments

        Activity

          People

            support-lep@liferay.com SE Support
            jdoe John Doe (Inactive)
            Kiyoshi Lee Kiyoshi Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              6 years, 51 weeks ago

              Packages

                Version Package