Monday, April 20, 2015

Portal Properties Hook in Liferay

Today we will discuss about Portal Properties hook.When we Create Account in liferay we have to provide the value of captcha today we disable the captcha field using Portal Properties hook.

We have file inside portal-impl (\ROOT\WEB-INF\lib) which contain some properties.Here some properties have multiple values and some have only one value like true/false.

All properties of can not be override,we can override only those properties that is mentioned in dtd file you can find dtd file in definition folder of source code .
ex:- liferay-hook_6_1_0.dtd.

So Lets start this step by step:-

Step 1:-DownLoad dtd file
First download liferay-hook_6_2_0.dtd file and check property related to captcha .Verify that any property is related to our requirement is available or not. Ex- we found properties like:-

Step 2:-Create Liferay hook project
File-->New-->Liferay Plugin Project-->Provide name-->Select hook in plugin type-->Finish

Step 3:-Create  hook inside project
Right click on project-->New-->Liferay hook Configuration-->tick>Next

Then in specify properties to override click on Add button

Then Add Property override box is open click on select and select 
captcha.check.portal.create_account and provide value to false

Click ok and finish.

Step 4:-Check generated files
All files are generated automatically you can see :-

a) src)


b)liferay-hook.xml(inside web-inf)

Step 5:-Check output
Deploy the hook by right click on build.xml-->Run As-->Ant Build. Go to your browser click on sign in and than Create Account link:-

As you can see there is no Captcha here.

Project Structure

No comments:

Post a Comment

Total Pageviews

Like Us on Facebook

Number Of Unique Visitor

Free counters!