
Default User Portlets
Introduction #
During liferay customization one common requirement is to configure the default portlets that are added to the pages of users or to the default guest community. For example instead of showing the portlets "Hello World" or "Currency Converter" we may want to show some custom portlets called "AboutUs" and "OurMileStones".
Default user public and private pages #
Like most of the configuration options in Liferay they are specified in the file Portal.properties. The default configuration looks like this:
# # Set the portlet ids for the columns specified in the layout template. # default.user.public.layout.column-1=82,23
Where 82,83 are the portlet id (portlet-name) of the portlets "Alerts" and "Language" respectively. The id of the portlet is specified in the portlet.xml file. If the portlet is distributed as part of a plugin the name of the plugin is suffixed as shown below with the following format:
porltetName_WAR_warFileNameAs an example let's assume that we have developed two new portlets called "AboutUs" and " OurMileStones". We are distributing them within a plugin called MyCompany.war. To add these portlets by default in the private make this portlet default for user public lay out, edit portal-ext.properties as follows.
default.user.public.layout.column-1=AboutUs_WAR_MyCompany,OurMileStones_WAR_MyCompany
The example in the previous seciton was showing how to change the portlets available in the area of the page referred to as "column-1". Usually all areas are named with the prefix "column-" followed by a number from 1 to 10 (the actual names may vary depending on the Layout Templates being used). For example:
default.user.public.layout.column-2=11,29,8,19 default.user.public.layout.column-3= default.user.public.layout.column-4=
It's also possible to follow a very similar set of properties to specify the default portlets of the private pages of a user:
default.user.private.layout.column-1= default.user.private.layout.column-2= default.user.private.layout.column-3= default.user.private.layout.column-4=
How to provide different configurations based on the user profile #
If you need different configuration based on the user profile check How To Use User Group Page Templates
Default portlets for the Guest community #
It's also possible to specify through configuration the default portlets shown in the public pages Guest community. Just follow the same instructions as those of the previous section with the following properties
default.guest.public.layout.column-1=58 default.guest.public.layout.column-2=47 default.guest.public.layout.column-3= default.guest.public.layout.column-4=