Wednesday, December 17, 2014

Liferay Portal Properties Hook Plugin

Liferay Hooks are used to customize the liferay portal. We have many kinds of hook plugins one of the hook is Portal Properties hook.

Introduction to Liferay Hook Plugins 

Portal properties hook overriding the existing portal properties and Portal properties hook can modify the some of the portal properties not all the portal properties. The modifiable list of properties are specified in liferay-hook_6_x_x.dtd file. 

If the properties are not listen in the liferay-hook_6_x_x.dtd file then we cannot modify it from portal properties hooks. Assume we want to modify login.events.pre ,login.events.post properties then we will use Portal Properties Hooks. 

If the portal properties are not listed in above then its not possible to override from portal properties hook plugins then we have to use portal-ext.properties file.

Existed Behavior of Liferay portal Create Account Page

In the liferay portal create account page we cannot find password field that user can create his own password at the time of registration.

After registration  user will get mail with auto generated password to login into portal and then he/she can change the password from his/her my account page password section.

Existed User Create Account Page in Liferay



Customer Expected Behavior of Create Account Page

Now assume we want create account page so that user can choose his/her own password at time of registration

The following are basic steps we should consider

Here our requirement is customize the existed liferay portal so best choice is hook plugins.

We have many kind of hook plugins so first we need to check with any portal property that can full fill out requirement.

Need to search in  liferay-hook_6_x_x.dtd   for appropriate portal property that can solve our problem.

If we find relevant portal property then we will choose portal  properties hook Plugin to implement it otherwise we should go for other type of hook Plugin.

In our case “login.create.account.allow.custom.password” is full fill our requirement. “login.create.account.allow.custom.password” is portal property that will allow user to choose custom password at the time of registration means it will accommodate two more user input fields in the create account page.

Implement Solution using Portal Properties Hook

Direct Steps

Step:1

Create Liferay Hook Project using below Article

Liferay Hook Plugin Development with Liferay IDE

Step:2

Configure portal properties file name in “liferay-hook.xml”  its in hook Plugin WEB-INF directory (/Sample-hook/docroot/WEB-INF/liferay-hook.xml) 

Add following configuration in “liferay-hook.xml

<hook> 
<portal-properties>portal.properties</portal-properties> 
</hook>

Step:3

Create “portal.properites” file in Plugin Hook src directory (/Sample-hook/docroot/WEB-INF/src/portal.properties)

Step:4

Add overridden property name and its value in “portal.properites” file that is  Plugin Hook src directory and possible overridden portal properties are available in “liferay-hook_6_x_x.dtd”

Add Overridden Portal Property in hook “portal.properties” files as follows

login.create.account.allow.custom.password=true

Step:5

Once we done all above steps deploy the Hook Plugin by double click on deploy target in the ANT view of eclipse or you can use “ant deploy” target from command prompt.

Once Portal Properties Hook Plugin successfully deployed ,now go to create account page then you can see password fileds in the page

The following screen shows you password filed




Crete Portal properties Hook using Liferay IDE Graphical User Interface

First we need to create Liferay Hook Plugin please follow the article and Create liferay hook Plugin

Liferay Hook Plugin Development with Liferay IDE

Now select the created hook Plugin in the project explorer

Go to File--> New Liferay Hook Configuration

now you can see dialog window  select portal properties check box then click on next


Now you can see another dialog there you can see two sections in the bottom section is for adding portal properties. Now click on Add button 



Now you will get another window there you can see property name and value input fields . For property name you can see “select” button


Now click on “select” button it will show another dialog to select possible portal properties.

Choose required property then click on OK


Now selected property will be appear in the property filed and enter appropriate values for the property in the values filed.


Click the OK and finally click on the Finish button. Now the portal properties file will be created in the hook src directory (“/Sample-hook/docroot/WEB-INF/src/portal.properties”).

The overridden properties and values are present in the “portal.properties” file



Overriding More Portal Properties

In the project explored go to /Sample-hook/docroot/WEB-INF  and double click on “liferay-hook.xml” file then it will be open in editor and we have two views “source” view and “overview”, default view is “overview”

The following is “overview” of “liferay-hook.xml” 



Note:

All hook related configuration are placed in “liferay-hook.xml” 

In the “overview” you can find “Portal properties”  icon with text ,click on that and check the “Customize Liferay Portal Properties” As soon as you check the box then you can see “portal properties” input field and “portal properties overrides” that can have two sections “Name” and “Value”

The following screen show you required input fields


Now we can see Add icon(+)  click on Add icon then you can see Name and Value fields in the bottom of “Portal Properties Overrides” input field.


Now in the name field you can see browse button. You can click on browse button then you can see dialog window there you can see all possible portal properties that can be overridden and you can have search field to search properties.


Now select required property and click on OK  then it will be appear  in the “Override Name” field and enter appropriate value in “Override Value” field


If we want we can also add more values or you can remove values using Add and Remove icons.

Once we done then save the file (Ctrl+S).

In the source view you can see the “liferay-hook.xml” as follows 


Ass soon as we save the file then portal property name and overridden value will be written in “portal.proerties” file that is in hook Plugin src directory



Once we done all above steps deploy the Hook Plugin by double click on deploy target in the ANT view of eclipse or you can use “ant deploy” target from command prompt.

Once Portal Properties Hook Plugin successfully deployed  then you can see respective changes in the liferay portal.

The following are possible portal properties that we can override using hook plugins

admin.default.group.names 
admin.default.role.names 
admin.default.user.group.names 
asset.publisher.asset.entry.query.processors 
asset.publisher.display.styles 
asset.publisher.query.form.configuration 
auth.forward.by.last.path 
auth.public.paths 
auto.deploy.listeners 
application.startup.events 
auth.failure 
auth.max.failures 
auth.token.ignore.actions 
auth.token.ignore.portlets 
auth.token.impl 
auth.pipeline.post 
auth.pipeline.pre 
auto.login.hooks 
captcha.check.portal.create_account 
captcha.engine.impl 
com.liferay.portal.servlet.filters.*Filter 
company.default.locale 
company.default.time.zone 
company.settings.form.authentication 
company.settings.form.configuration 
company.settings.form.identification 
company.settings.form.miscellaneous 
control.panel.entry.class.default 
convert.processes 
default.landing.page.path 
default.regular.color.scheme.id 
default.regular.theme.id 
default.wap.color.scheme.id 
default.wap.theme.id 
dl.file.entry.drafts.enabled 
dl.file.entry.processors 
dl.repository.impl 
dl.store.antivirus.impl 
dl.store.impl 
dockbar.add.portlets 
field.enable.com.liferay.portal.model.Contact.birthday 
field.enable.com.liferay.portal.model.Contact.male 
field.enable.com.liferay.portal.model.Organization.status 
hot.deploy.listeners 
javascript.fast.load 
journal.article.form.add 
journal.article.form.translate 
journal.article.form.update 
layout.form.add 
layout.form.update 
layout.set.form.update 
layout.static.portlets.all 
layout.template.cache.enabled 
layout.types 
layout.user.private.layouts.auto.create 
layout.user.private.layouts.enabled 
layout.user.private.layouts.power.user.required 
layout.user.public.layouts.auto.create 
layout.user.public.layouts.enabled 
layout.user.public.layouts.power.user.required 
ldap.attrs.transformer.impl 
locales 
locales.beta 
locales.enabled 
lock.listeners 
login.create.account.allow.custom.password 
login.events.post 
login.events.pre 
login.form.navigation.post 
login.form.navigation.pre 
logout.events.post 
logout.events.pre 
mail.hook.impl 
my.sites.show.private.sites.with.no.layouts 
my.sites.show.public.sites.with.no.layouts 
my.sites.show.user.private.sites.with.no.layouts 
my.sites.show.user.public.sites.with.no.layouts 
organizations.form.add.identification 
organizations.form.add.main 
organizations.form.add.miscellaneous 
passwords.passwordpolicytoolkit.generator 
passwords.passwordpolicytoolkit.static 
passwords.toolkit 
phone.number.format.impl 
phone.number.format.international.regexp 
phone.number.format.usa.regexp 
portlet.add.default.resource.check.enabled 
portlet.add.default.resource.check.whitelist 
portlet.add.default.resource.check.whitelist.actions 
rss.feeds.enabled 
sanitizer.impl 
servlet.session.create.events 
servlet.session.destroy.events 
servlet.service.events.post 
servlet.service.events.pre 
session.max.allowed 
session.phishing.protected.attributes 
session.store.password 
sites.form.add.advanced 
sites.form.add.main 
sites.form.add.seo 
sites.form.update.advanced 
sites.form.update.main 
sites.form.update.seo 
social.activity.sets.bundling.enabled 
social.activity.sets.enabled 
social.activity.sets.selector 
social.bookmark.* 
terms.of.use.required 
theme.css.fast.load 
theme.images.fast.load 
theme.jsp.override.enabled 
theme.loader.new.theme.id.on.import 
theme.portlet.decorate.default 
theme.portlet.sharing.default 
theme.shortcut.icon 
time.zones 
upgrade.processes 
user.notification.event.confirmation.enabled 
users.email.address.generator 
users.email.address.required 
users.email.address.validator 
users.form.add.identification 
users.form.add.main 
users.form.add.miscellaneous 
users.form.my.account.identification 
users.form.my.account.main 
users.form.my.account.miscellaneous 
users.form.update.identification 
users.form.update.main 
users.form.update.miscellaneous 
users.full.name.generator 
users.full.name.validator 
users.image.max.height 
users.image.max.width 
users.screen.name.always.autogenerate 
users.screen.name.generator 
users.screen.name.validator 
value.object.listener.*
Author

17 comments :

  1. buy tik tok followers Increase your exposure on social media! Check out our deals and buy Instagram Followers, Buy Youtube Subscribers, and more! Fast, cheap, and 24/7 Support.

    ReplyDelete
  2. I read this article. I think You put a great deal of exertion to make this article.

    buy soundcloud plays

    ReplyDelete
  3. The yearly lease line will ascertain the yearly rental pay from the property every year. The equation for the principal year shows up as follows: Emergency Tree Service Stockton

    ReplyDelete
  4. How about we accept that they will loan us another 5% of the property estimation as a value line. Enter 5% (in blue) in the value credit extension line under the % price tag heading. nova city developers islamabad

    ReplyDelete
  5. Many home insurance agencies will help with paying for this strategy in case this is a positive peril should it fall in a solid breeze or become removed during a flood. Emergency Tree Cutting Irvine

    ReplyDelete
  6. Roots can also puncture the sewer and plumbing lines. Sometimes, branches hang too low and puncture your home's roof; and when trees become too old, it can take just one storm to make it fall. Stump Removal Albuquerque

    ReplyDelete
  7. You change the cooling framework since you have inhabitants and tragically, they don't regard your hardware.plot for sale in university town islamabad

    ReplyDelete
  8. I am so grateful for your article. Much thanks again. Fantastic.
    Safe Stump Removal Austin

    ReplyDelete
  9. Tajarat strives to be Pakistan's biggest real estate developer ever, guaranteeing the highest international standards, prompt execution, and lifetime customer loyalty. For further detail visit lahore smart city payment plan

    ReplyDelete
  10. Really informative article post. Really looking forward to read more. Really Great.Woodburn tree trimming

    ReplyDelete
  11. Developers will be effective from your post. I am also developer, I am also got many knowledge from these ​services. At this time, you can take advantage from Air Conditioner Repair in Fort Worth TXand repair your Air conditioning.

    ReplyDelete
  12. It is really a nice and helpful piece of information about Life ray portal properties hook plugin. I’m glad that you shared this useful information with us. Please visit my web site descriptive essay writing help. Best Descriptive essay writing service provider.

    ReplyDelete
  13. Reaching and working straightforwardly with mortgage advance loan specialists is free, yet for this situation you can't expect the best arrangement except if you are accomplished about the mortgage business.
    https://rateconnect.ca

    ReplyDelete
  14. We should utilize the property estimation that we guage to have the option to compute property charges, so we must form the model in a specific request. https://www.osgoodeproperties.com/

    ReplyDelete
  15. Comparably self-evident, notwithstanding, is the primary disadvantage of a long term mortgage.
    www.toprankinmortgages.com

    ReplyDelete
  16. Later on, some real estate specialists might offer administrations in a greater amount of an ala carte design. completerealestatepros

    ReplyDelete

Recent Posts

Recent Posts Widget

Popular Posts