Sunday, November 4, 2012

OS4L - Custom Landing Page Hook


!!!! DOWNLOAD "OS4L Custom Landing Page Hook" from Liferay Market Place now !!!!







- - New options added for site & organization Private Page - -


Hi,

You might have followed my other blog regarding Custom Landing Page Hook. Today I've make some modification in that and made a hook which will be very easy to use without any modification for general use.

I've made it work with a small property change based on your requirement of which landing page you want user to land.
Inside portal.properties in my hook, you'll find below property.



##
## Set this property as per your needs for landing page after user log in. It could be from one of
## the value from below options
## 1. userPrivatePage
## 2. userPublicPage
## 3. sitePublicPage - Newly Added
## 4. sitePrivatePage - Newly Added
## 5. organizationPublicPage - Newly Added
## 6. organizationPrivatePage - Newly Added
##
custom.landing.page.type={userPrivatePage/userPublicPage/sitePublicPage/sitePrivatePage/organizationPublicPage/organizationPrivatePage}



UPDATES - New Option Added !!

- There is a new option added by which any specific page within a Site/Organization can be made a landing page for that Site/Organization instead of their home page.
Just create a custom attribute of Site/Organization by mentioning the page friendlyURL.

For defining,
1) Site/Organization's Public page
- Create custom attribute of type "TextField" with key "landingPagePublic" and define value as desired page's friendlyURL. i.e. /welcome
2) Site/Organization's Private page
- Create custom attribute of type "TextField" with key "landingPagePrivate" and define value as desired page's friendlyURL. i.e. /myhome


So you just need to set value of custom.landing.page.type from on of the value from userPrivatePage, userPublicPage, sitePublicPage, sitePrivatePage, organizationPublicPage or organizationPrivatePage. So based on the selection hook will land the user on desired page.

Downloads
- OS4L Custom Landing Page Hook packaged war. (v1.2)
OS4L Custom Landing Page Hook Git source - Maven

Now the entire source code is also available from Opensourceforlife Git repository. Feel free to fork it.



6 comments :

  1. Great Hook Tejas, thanks a lot for this! (I used to use this one http://www.corak-it.de/liferay/downloads.html/-/software_catalog/products/47972;jsessionid=222C0490A9A2E7F78723AED74A79FCA5 but it's apparently not working with 6.1.1 GA2)

    I noticed that when set to redirect to the organization, your hook redirects to the public page of the organization: in my case, there are only private pages so I get an error: how could i redirect the user to the organization private page instead of public page?

    Sorry to be such a newbie, and thanks a lot for your help!

    ReplyDelete
  2. Hi Xavier,

    As per your requirement and to make it generalize to use it with all possible options, I've added new options which will allow you to land on organization's Private page as well. Just check the latest property option. I've also modified the war and if you want you'll get the code from OS4L git repository mentioned in blog post.

    http://www.opensourceforlife.com/2012/11/ospl-custom-landing-page-hook.html

    Hope this helps.

    Thanks,
    Tejas

    ReplyDelete
  3. Thanks a ton Tejas, it does help a lot!!

    I just deployed it and it's working perfectly, many many thanks for this

    ReplyDelete
  4. Hello,

    first of all thanks for the nice tutorial!

    I tried this by deploying the .war file in the deploy folder. Then I found the portal.properties file in the Hook.

    I set the values in the properties file to userPublicPage. But when I logg in it redirects me on another page.

    ReplyDelete
    Replies
    1. Thanks Konstantin for writing. And sorry for late reply.

      - After making change in portal.properties in webapps/customlandingpage-hook/WEB-INF/classes, have you restarted the server ?
      - After making it to userPublicPage in portal.properties, where it is landing a user ? which page ?
      - Can you verify by manually going to that user's public page just to verify whether its exist or not ?

      Please let me know in whichever way I can be helpful.

      Thanks,
      Tejas

      Delete