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 portal.properties 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 portal.properties can not be override,we can override only those properties that is mentioned in dtd file you can download dtd file from liferay-hook_6_2_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 property
captcha.check.portal.create_account






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 portal.properties-->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)portal.propertise(inside src)

captcha.check.portal.create_account=false

b)liferay-hook.xml(inside web-inf)
<hook>
<portal-properties>portal.properties</portal-properties>
</hook>

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