Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kamesh Sampath
User Default Private-Public Pages
March 1, 2012 12:19 AM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

Hi,

Is there a way to make the user get a specific set of pages for his private and public pages ?

I have created a template for each of the user public and private pages using Page templates, in fact attached the same to the a Site lets call it "MySite".

What am trying to achieve is that when the user created, the Portal provides us a mechanism to set his personal site, I am trying to set "MySite" for the same, and when the user navigates to the public/private pages he should be able to view the "MySite"'s public and private pages rather than the default ones thats provided by Liferay for the "My Public Pages" and "My Private Pages".

So adding to my question,

  1. Is this doable via Control Panel
  2. or We need to write a Hook for it ?


Thanks.

--Kamesh
David H Nebinger
RE: User Default Private-Public Pages
March 1, 2012 5:20 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11249

Join Date: September 1, 2006

Recent Posts

There is support for defining the public/private pages in the portal-ext.properties file (the layout, the portlet list) that has been there for ages. I'm not sure if the new dynamic templates can apply to users or not, but there is a way to do what you're asking w/o writing a hook...
Sandeep Nair
RE: User Default Private-Public Pages
March 1, 2012 5:26 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

If it is more than one page, then you can create a set of pages, export them as lar and use the following properties

#
# Specify a LAR file that can be used to create the guest public layouts.
# If this property is set, the previous layout properties will be ignored.
#
#default.guest.public.layouts.lar=${liferay.home}/deploy/default_guest_public.lar

#
# Specify a LAR file that can be used to create the guest private layouts.
# If this property is set, the previous layout properties will be ignored.
#
#default.guest.public.layouts.lar=${liferay.home}/deploy/default_guest_private.lar


Note after setting this, the pages would be automatically created for new user only. For old user, they will still have old pages. You have to individually delete all their public and private pages, so that on next login they get the new set of pages.

Regards,
Sandeep
Kamesh Sampath
RE: User Default Private-Public Pages
March 1, 2012 8:54 AM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

Thanks a lot for your answers will try these and keep you posted emoticon

I used default.user.private.layouts.lar=$LAR_FILE_PATH for multiple pages for user spefic, but we could try using default.<group_name>.public.layouts.lar for handling group specific public/private layouts.

What is your thoughts on the same ??
Sandeep Nair
RE: User Default Private-Public Pages
March 1, 2012 11:05 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

I think its only needed for user, the primary reason being user sites are automatically created when user is created and many a time as for example in your case we dont want the default home page and want set of pages.

For others i think Site templates is just fine, since we have control of applying site templates through UI

Regards,
Sandeep
Kamesh Sampath
RE: User Default Private-Public Pages
March 2, 2012 4:21 PM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

I facing an issue when i try logging in to portal for a newly created user,


an-unexpected-system-error-occurred

com.liferay.portal.kernel.exception.SystemException: com.thoughtworks.xstream.converters.ConversionException: null : null ---- Debugging information ---- cause-exception : java.lang.NullPointerException cause-message : null class : com.liferay.portal.model.impl.LayoutImpl required-type : org.apache.commons.lang.time.FastDateFormat path : /com.liferay.portal.model.impl.LayoutImpl/_layoutType/_dateFormat line number : 85 -------------------------------


I have the following entry in my potal -ext.properties,
#
# Specify a LAR file that can be used to create the user private layouts. If
# this property is set, the previous layout properties will be ignored.
#
default.user.private.layouts.lar=${liferay.home}/deploy/default_user_private_201203022359.lar

This even happens when I create a Site template and add it to the User Group via the Control Panel, when creating the group .

Any idea what is wrong ? I saw a related bug /LPS-24702

My Portal platform is:

Liferay 6.1.0-CE.GA with PotgresSQL 9.1
Kamesh Sampath
RE: User Default Private-Public Pages
March 5, 2012 11:44 PM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

Sandeep Nair:
I think its only needed for user, the primary reason being user sites are automatically created when user is created and many a time as for example in your case we dont want the default home page and want set of pages.

For others i think Site templates is just fine, since we have control of applying site templates through UI

Regards,
Sandeep


Sandeep,

I tied following the method and added the following combination of properties to my portal-ext,

 1#
 2## Group based setting
 3#
 4default.guest.private.layout.name=UserHome
 5default.guest.public.layout.name=UserHome
 6
 7default.guest.public.layout.friendly.url=/userhome
 8default.guest.private.layout.friendly.url=/userhome
 9
10#
11## User specific setting
12#
13default.user.private.layout.name=UserHome
14default.user.public.layout.name=UserHome
15
16default.user.public.layout.friendly.url=/userhome
17default.user.private.layout.friendly.url=/userhome


But still by default when i login, the user home page is the default and not the one i mentioned above userhome which is the page that i have created and want all the users to land in that page after login ..

Not sure this is the right way to do it ?

--Kamesh
Kamesh Sampath
RE: User Default Private-Public Pages
March 5, 2012 11:53 PM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

Even when i tried this am getting the same error as mentioned in the previous thread when i try to set it as default private home in the Control panel/.
Sandeep Nair
RE: User Default Private-Public Pages
March 6, 2012 10:54 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

Hi Kamesh,

I think its because the user with whom you are trying to login already has already logged in before you set the property and the page was created. Can you please try this with a new user.

For existing user, you need to delete the existing page and let him login again. The logic is written in ServicePreAction class and they check if the user already has page, dont do anything else create a page from him

Regards,
Sandeep
Kamesh Sampath
RE: User Default Private-Public Pages
March 9, 2012 8:02 AM
Answer

Kamesh Sampath

Rank: Regular Member

Posts: 159

Join Date: May 26, 2010

Recent Posts

Hi Sandeep,

Thanks for the thoughts.

I did try the same with fresh user who has not logged even once, but I get HTTP 404 on the screen and log trace saying the same error.

Let me try with a clean database and clearing temp etc.,

--Kamesh