« Back

Turn Liferay into a Blog Service - Part 1.1

Company Blogs June 12, 2008 By Ivan Cheung Staff

I've been playing around with Liferay portal version 5.0.1 and have found some new features that make it easy to create a community driven website.  When I hear good news, I just wanna share it, so here it is.  Enjoy!

Part 1.1 is meant for beginner Liferayers to get familiar with some of the cool out of the box settings Liferay portal has that may help you in other projects. The footnotes provide details for more curious folks!  At the end of Part 1.1, you will have configured Liferay so that strangers can sign up for an account on your website.  In this section, we won't do ANY programming. 

Installation
- Download Liferay + Tomcat bundle: http://downloads.sourceforge.net/lportal/liferay-portal-tomcat-5.5-5.0.1.zip
- Unzip the bundle to a directory of your choice.
- Let's browse to where you unzipped the Liferay Tomcat bundle; I will refer to this location as $TOMCAT_HOME.  Go to $TOMCAT_HOME\bin and double click on startup.bat.
- Open a web browser and browse to http://localhost:8080

Checkpoint
If you are having trouble with installation, refer to: http://www.liferay.com/c/portal/flash?movie=http://docs.liferay.com/4.4/videos/1001.swf

Default Account Creation
At the upper right hand corner of the screen, you should see a dock menu.  Hovering over it will produce a Sign In button.
- Click the Sign In button.



 

- Click on Create Account.  Notice the different fields on the registration screen. 

I've indicated the required fields (1):


- Fill in the required fields and click Save.
- You get redirected to the Login screen where it will also mention an autogenerated password.
- Use the password and email to Login to the portal.  Notice the Terms of Use that you must Agree to before proceeding.
- You finally land on a page with a bunch of default portlets.  This is called a user's personal community or "My Community" (2). 

Checkpoint

Now you know the default account creation process.  Let's modify some of this process by changing portal-ext.properties (3).  Remember, no coding during in this section!

Custom Account Creation
- Browse to $TOMCAT_HOME\webapps\WEB-INF\classes\.  If it doesn't exist, create a file called portal-ext.properties.
- Inside portal-ext.properties append the following and save:

    admin.default.role.names=Power User\nUser

    field.enable.com.liferay.portal.model.Contact.male=false
    field.enable.com.liferay.portal.model.Contact.birthday=false
    field.enable.com.liferay.portal.model.Organization.status=false   

    captcha.max.challenges=-1

    terms.of.use.required=false

    auth.forward.by.last.path=false

- Restart Tomcat (4) and go through the Account Creation process again.  Did you see the differences? 

Checkpoint
You've set up a website that will allow strangers to register for accounts and get their own set of personal web pages.  You also know how to utilize the portal properties to customize Liferay to behave differently than the default.  You should try exploring other portal settings (5).  Stay tuned for the next Part in this series, which will cover customizing a user's personal web page.

------------------------------------------------------------
Footnotes
(1) user account creation required fields
By default, Liferay requires at the very minimum a first and last name, screen name, and email address to create new user account.

(2) My Community
A personal community is simply a special set or group of web pages for a specific user.  Does every user get a personal community?  No.  Only user's with the Power User role get their own "My Community".  By default, newly created users get the Power User and User role as specified in this portal.property setting:

    admin.default.role.names=Power User\nUser

(3) portal-ext.properties
All of Liferay's portal specific settings are stored in a file called portal.properties.  So naturally, we'd want to modify portal.properties if we want to change any settings right?  Wrong.  Liferay was created in a way so that folks like you and me could modify ANYTHING, but the best way was to create an Extension environment where we make our changes.  If we modify the source code directly, it will make it difficult to do upgrades in the future.  What's the Extension equivalent of portal.properties?  It's portal-ext.properties.

(4) Modifying portal-ext.properties
You must restart the server in order for your modifications to take affect.  Also, your modifications don't change old data; they only affect new data.  This means that if you changed the portal's settings so that new users get the 'Power User' and 'User' role, the setting will not affect users who were created prior to your modification.

(5) Properties explained:
The Birthday, Gender, Text Verification (captcha), and Terms of Use are now hidden because of:
    field.enable.com.liferay.portal.model.Contact.male=false
    field.enable.com.liferay.portal.model.Contact.birthday=false
    captcha.max.challenges=-1
    terms.of.use.required=false

Since we want all users to receive personal communities we want to make sure to include this setting:
    admin.default.role.names=Power User\nUser

We can ensure that a user always get forwarded to their peronal community's web pages when they login with this:
    auth.forward.by.last.path=false

You can download Liferay portal 5.0.1 source code to see more details for these settings: http://downloads.sourceforge.net/lportal/liferay-portal-src-5.0.1.zip
Just unzip and browse to $SOURCE_HOME/portal-impl/src/portal.properties

Changes

June 17, 2008:    captcha.max.challenges=0   -->     captcha.max.challenges=-1

 

Threaded Replies Author Date
Hey Ivan, This post is very good. Have you... Jorge Ferrer June 12, 2008 4:52 AM
Great suggestion Jorge, I'll bring it over to... Ivan Cheung June 12, 2008 5:10 PM
Here it is: ... Ivan Cheung June 12, 2008 10:16 PM
nice job, Ivan! James Min June 12, 2008 9:32 AM
Hey Ivan, The property... Brian Chan June 12, 2008 9:34 AM
Thanks Brian, I'll make sure include this... Ivan Cheung June 12, 2008 5:12 PM
I am looking for a blog tool to support a new... wadood rahman July 1, 2008 4:43 PM
Hi Wadood, If you are looking to build your... Ivan Cheung July 1, 2008 5:54 PM

Hey Ivan,

This post is very good. Have you thought of adding a version of it to the wiki? That way it'll be easier for people to find it and also it'll be easier to adapt to newer versions of Liferay as they appear.
Posted on 6/12/08 4:52 AM.
nice job, Ivan!
Posted on 6/12/08 9:32 AM.
Hey Ivan,

The property "admin.default.role.names" is available via Enterprise Admin -> Settings -> Default User Associations. So they don't have to edit that manually.

The other properties are still only modifiable from the file. Great post man.
Posted on 6/12/08 9:34 AM.
Great suggestion Jorge, I'll bring it over to the wiki.
Posted on 6/12/08 5:10 PM in reply to Jorge Ferrer.
Thanks Brian, I'll make sure include this tidbit in the wiki too.
Posted on 6/12/08 5:12 PM in reply to Brian Chan.
Here it is: http://wiki.liferay.com/index.php/Turn_Liferay_Into_A_Blog_Service
Posted on 6/12/08 10:16 PM in reply to Jorge Ferrer.
I am looking for a blog tool to support a new blog website with user base any where btw 10- 30 million users (open to public). Do you recommend Blog portal of liferay i know the portal, content management solution pretty well, but new to take decision for the blog solution using liferay.
Posted on 7/1/08 4:43 PM.
Hi Wadood,

If you are looking to build your blog website on Liferay, you should set up your environment and run performance and load tests and share your findings with me! The advantages of using Liferay are much if you are interested in customization and providing more than just a blogging platform. This is where portlets and custom portlets come into play.
Posted on 7/1/08 5:54 PM in reply to wadood rahman.