28 September, 2012

Maven build with liferay

Nice tutorial by http://www.eusia.info

Have a look !!!

Assuming that you have JDK and Maven set up in you machine, I will write here how we can have a liferay project in minimal effort and make it distributable in all environments.
We will use Maven archtype plug-in to create liferay project.
Consider a folder as your project home, like: /home/manna/examples/liferay
if you working with maven you can have several maven settings based on project requirements, so better to have a different maven settings file like here we have : /home/manna/.m2/eusiaweb.xml

14 September, 2012

Get user roles in theme velocity template

Many times we have requirement coming out to fetch user roles in theme velocity template (.vm) file.
So below code you can use for Liferay 6.X :


Hope this will useful !!!
Jignesh Vachhani

13 September, 2012

Liferay search container without database

If you want to use search container in which data will come from Array rather than database,
you can simply use below code :

07 September, 2012

Export user fields in CSV file

You can set below property to export user fields in CSV format :

    # Input a list of user attributes that will be included when exporting users
    # to a CSV file. You can include custom fields by adding the prefix
    # "expando:" to the attribute name.

User portrait image settings

User portrait image related settings in portal-ext.properties file :

    # Set the maximum file size for user portraits. A value
    # of 0 for the maximum file size can be used to indicate unlimited file
    # size. However, the maximum file size allowed is set in the property
    # "com.liferay.portal.upload.UploadServletRequestImpl.max.size".

    # Set the maximum user portrait height and width in pixels. A value of 0
    # indicates no restictions on user portrait dimensions.

Create users without email address

If you want to create user with out email address, just set below properties :

# Set this to false if you want to be able to create users without an email
# address. An email address will be automatically assigned to a user based
# on the property "users.email.address.auto.suffix".


# # Set the suffix of the email address that will be automatically generated
# for a user that does not have an email address. This property is not used
# unless the property "users.email.address.required" is set to false. The
 # autogenerated email address will be the user id plus the specified suffix.


# Input a class name that implements
# com.liferay.portal.security.auth.EmailAddressGenerator. This class will be
# called to generate an email address for a user that does not specify an
# email address. This class will only be used if the property
# "users.email.address.required" is set to false.


User screen name related settings

Here are some of the properties which can be override in portal-ext.properties file as per your requirement :

# Set this to true when you want the validation to allow for creation of
# numeric screen names.

# # Set this to true to always autogenerate user screen names even if the user
# gives a specific user screen name. If this is set to true, the LDAP
# importer will fetch users by their email address even if the property
# "company.security.auth.type" is set to screenName.

 # # Input a class name that implements
 # com.liferay.portal.security.auth.ScreenNameGenerator. This class will be
# called to generate user screen names.

# # Input a class name that implements
# com.liferay.portal.security.auth.ScreenNameValidator. This class will be
# called to validate user screen names.
users.screen.name.validator=com.liferay.portal.security.auth.DefaultScreenNameValidator #users.screen.name.validator=com.liferay.portal.security.auth.LiberalScreenNameValidator  

User should not be deleted

If you don't want to allow users to be deleted from liferay, just set below property in portal-ext.properties file:

 # # Set this to false if users cannot be deleted.

Disable auto deploy

    # Set below property to false to true to disable auto deploy of layout templates, portlets, and
    # themes.

Solve ECJ error in liferay IDE

I know that this is very well known error but still think to put it here as it could be helpful in some situation.
Task cannot continue because ECJ is not installed. ECJ was automatically installed. Please rerun your task. Total time: 1 second