Olaf Kock 9 Years Ago How did you know that I just needed to summarize this?Less effort for me \o/ - I'll keep this reference in my toolbox. Please sign in to reply. Reply as... Cancel
Ahmed Hasan 9 Years Ago Very good coverage of portlet preferences. Ahamed HasanAuthor, Liferay Cookbook Please sign in to reply. Reply as... Cancel
Venkat Koppavolu 9 Years Ago Very well explained !!Thanks,Venkat Please sign in to reply. Reply as... Cancel
Christophe Cariou 9 Years Ago Great explanation. When (or where) do you post the second part ? Please sign in to reply. Reply as... Cancel Peter Mesotten Christophe Cariou 9 Years Ago Coming soon... :-) Please sign in to reply. Reply as... Cancel
Peter Mesotten Christophe Cariou 9 Years Ago Coming soon... :-) Please sign in to reply. Reply as... Cancel
Peter Mesotten 9 Years Ago Part 2 of this series was just posted: https://www.liferay.com/web/pmesotten/blog/-/blogs/user-specific-versus-shared-portlet-preferences-part-2.This part will explain a way for storing preferences for a Liferay portlet in multiple scopes at the same time. Please sign in to reply. Reply as... Cancel
Marko Perić 9 Years Ago Hello Peter, First of all, great post. I would really appreciate if you could see my problem I posted on forum and I think this blog post could solve my problem. Link: https://www.liferay.com/community/forums/-/message_boards/message/47911045I have used 4th option from your list, "per-user, per-portlet" but it didn't help, two users still see the same data.Please take a look on a link.Thank you very much. Please sign in to reply. Reply as... Cancel
Thomas Berg 9 Years Ago Hi Peter, great article!I need to be able to store preferences by instance, regardless of plid. I was hoping that this could be achieved by setting preferences-owned-by-group=true, preferences-unique-per-layout=false and instanceable=true but the _INSTANCE_xyz is "shaved off" when the preferences are stored. The portlets are embedded dynamically and can possibly be viewed on different layouts. An update to the preferences in one place must be "propagated" so that any other view of the same instance gets the same preferences.With this requirement, do you think it would be possible to "synchronize" preferences for portlets with the same id (and instance) in a model listener? I assume it's possible to update a model without notifying its listeners or the listener would be called indefinitely? Please sign in to reply. Reply as... Cancel Peter Mesotten Thomas Berg 9 Years Ago @Thomas,Thanks for your feedback!What I don't get is why you want to use an instanceable portlet. I guess the preferences should be user specific but not really portlet instance specific, so you could use the combination (preferences-company-wide=false, preferences-unique-per-layout=false, preferences-owned-by-group=false). In that case however, your portlet must be non-instanceable. This is no problem as long you don't need multiple portlet instances on the same page.The approach with the model listener seems rather hacky, so I wouldn't really recommend that. Please sign in to reply. Reply as... Cancel Thomas Berg Peter Mesotten 9 Years Ago @PeterMy reasons for wanting preferences by instance are these:I embed a JournalArticle and optionally a Web Form Portlet in a view. The embedded web form has default preferences set and its instance id is set by a combination of the articleId and the articles groupId. The portlet that shows this view can possibly be added to multiple layouts in multiple sites. If an administrator edits the preferences of the embedded web form, only the form on that particular layout would be affected.If I could store preferences per instance and group rather than per layout, all views would use the same preferences. Unfortunately, this is not possible as the INSTANCE-part of the portletId is cut off when preferences are stored for preferences-owned-by-group=true and preferences-unique-per-layout=false in combination with instanceable.I submitted a feature request:https://issues.liferay.com/browse/LPS-54751I agree that using a Model Listener is hacky at best and will not go that way. Perhaps I'll look into overriding com.liferay.portal.service.PortletPreferencesLocalService with a hook (or disable to possibility to edit preferences of the web form).Thanks! Please sign in to reply. Reply as... Cancel
Peter Mesotten Thomas Berg 9 Years Ago @Thomas,Thanks for your feedback!What I don't get is why you want to use an instanceable portlet. I guess the preferences should be user specific but not really portlet instance specific, so you could use the combination (preferences-company-wide=false, preferences-unique-per-layout=false, preferences-owned-by-group=false). In that case however, your portlet must be non-instanceable. This is no problem as long you don't need multiple portlet instances on the same page.The approach with the model listener seems rather hacky, so I wouldn't really recommend that. Please sign in to reply. Reply as... Cancel Thomas Berg Peter Mesotten 9 Years Ago @PeterMy reasons for wanting preferences by instance are these:I embed a JournalArticle and optionally a Web Form Portlet in a view. The embedded web form has default preferences set and its instance id is set by a combination of the articleId and the articles groupId. The portlet that shows this view can possibly be added to multiple layouts in multiple sites. If an administrator edits the preferences of the embedded web form, only the form on that particular layout would be affected.If I could store preferences per instance and group rather than per layout, all views would use the same preferences. Unfortunately, this is not possible as the INSTANCE-part of the portletId is cut off when preferences are stored for preferences-owned-by-group=true and preferences-unique-per-layout=false in combination with instanceable.I submitted a feature request:https://issues.liferay.com/browse/LPS-54751I agree that using a Model Listener is hacky at best and will not go that way. Perhaps I'll look into overriding com.liferay.portal.service.PortletPreferencesLocalService with a hook (or disable to possibility to edit preferences of the web form).Thanks! Please sign in to reply. Reply as... Cancel
Thomas Berg Peter Mesotten 9 Years Ago @PeterMy reasons for wanting preferences by instance are these:I embed a JournalArticle and optionally a Web Form Portlet in a view. The embedded web form has default preferences set and its instance id is set by a combination of the articleId and the articles groupId. The portlet that shows this view can possibly be added to multiple layouts in multiple sites. If an administrator edits the preferences of the embedded web form, only the form on that particular layout would be affected.If I could store preferences per instance and group rather than per layout, all views would use the same preferences. Unfortunately, this is not possible as the INSTANCE-part of the portletId is cut off when preferences are stored for preferences-owned-by-group=true and preferences-unique-per-layout=false in combination with instanceable.I submitted a feature request:https://issues.liferay.com/browse/LPS-54751I agree that using a Model Listener is hacky at best and will not go that way. Perhaps I'll look into overriding com.liferay.portal.service.PortletPreferencesLocalService with a hook (or disable to possibility to edit preferences of the web form).Thanks! Please sign in to reply. Reply as... Cancel
Parkash Kumar 7 Years Ago Hello Peter,I have came across a situation that I need to set a portlet's preferences by group (site), that it should reflect same preferences set-up, while being updated from any page of that group. But, the tricky part is that the portlet should reflect different preferences for public and private pages of same group.I have already tried with preferences-unique-per-layout and preferences-owned-by-group, but I am observing that on updating portlet's preferences from either public or private pages, it is getting reflect on both.It there any option to set separate portlet preferences for public and private (pages) of a site? Please sign in to reply. Reply as... Cancel
Malhar Jajoo 7 Years Ago After using the portletpreference object to store the prefernce , So all we need to do is configure the liferay-portlet.xml ? Please sign in to reply. Reply as... Cancel