Hakantology
Hakantology

Reputation: 41

How to add a custom section to the User Edit Screen in Liferay?

I want to customize the User-Edit page in Liferay 6.2.

First of all I wanted to add a new section to the bar on the right of the user edit screen (https://i.sstatic.net/Rnilo.png). I have realized this with properties like

users.form.add.main=customportlet

When i click on the new created section it opens a blank page. How can I add content here (the data will be stored on separate tables)?

I know that i can create custom fields simply through the configurations but i would like to realize it on this way.

Upvotes: 1

Views: 658

Answers (1)

Tobias Liefke
Tobias Liefke

Reputation: 9022

What you are looking for is a hook.

You use the file WEB-INF/liferay-hook.xml as deployment descriptor:

<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" 
          "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
<hook>
    <portal-properties>portal.properties</portal-properties>
    <language-properties>Language.properties</language-properties>
    <custom-jsp-dir>/WEB-INF/custom_jsps</custom-jsp-dir>
</hook>

And you define your additional section in the file WEB-INF/classes/portal.properties:

# users.form.add.main is for the creation of a user only 
# I guess you mean the user edit screen:
users.form.update.main=my-section

Implement your section as JSP file in WEB-INF/custom_jsps/html/portlet/users_admin/user/my-section.jsp:

<%@include file="/html/portlet/users_admin/init.jsp" %>

<h3><liferay-ui:message key="my-section" /></h3>
<%-- Implement your section --%>

And label your section in WEB-INF/classes/Language.properties:

my-section = My Section

Thats it.

Upvotes: 2

Related Questions