Liferay Portal : How to change portlet look and feel on every page

Liferay Portal

A few days ago I had a task to update portlet title in ‘Sign-in’ Portlet, from ‘Sign-in’ into ‘myGeco for Consultant’ and the background colour to #f6f6f6. If I only used ‘Sign-in’ portlet in 1 page, then this task would be easily done by login as admin and changing the look and feel. But the problem is, I have so many pages, and almost every page is including this ‘Sign-in’ portlet. So the question is, how to update all the look-and-feel the effective way, not changing them one by one ?

Would it be possible to update directly into database ? And if possible, how to do it ?

So here are the steps to do it :

1. Create desired look and feel on 1 portlet in 1 page, save it. All the look and feel will be saved into database.

2. Find out what is the portletId, and pageId ( plid ).

3. From the database, select the portlet preference value for that portletId and pageId.

4. Update all pages that contains that portlet with new portlet preference.
On the first step, you need to update the look and feel on the portlet manually, and save it. This value will be saved into table portletpreferences, so we can use this value later to update all pages that contain that portlet.

On the second step, you need the portletid and pageid (plid) to do select from portletpreferences table. How do you find this portletid and pageid ? You can login as admin, and mouseover above ‘Minimize’ icon. You’ll find a javascript link like this :


javascript: minimizePortlet('10701', '58', false, '');

It means, the plid is 10701, the portletid is 58. Now you can do select into portletpreferences table by doing query like this :


select preferences from portletpreferences where plid=10701 and portletId='58';

Now, you’ve got the value you want, just update all the pages that contains portletId=’58’ with this value :


update portletpreferences set preferences='preferences_value_of_your_portlet' where portletId='58';

Done. Tested on Liferay 4.3.3

2 comments so far

  1. Rodrigo on

    Great tip!! Bookmarked. Thanks.

  2. Mano on

    If you have a custom theme, then it is easier to specifiy some custom CSS for that portlet.
    I use custom CSS to hide the sign in options (OpenID, …) for example.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: