Custom Field Liferay
1) The easiest way to add customfield is add customfield with control panel.
- Admin -> Control panel -> Configuraton -> custom fields -> Click user -> Add custom field -> Add key and Type (e.g key - nickname type - Text field index)
- Click on save Now you done.
- Create One Hook Liferay -> https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/customize-and-extend-functionality-hooks-liferay-portal-6-2-dev-guide-en
- Override html\portlet\users_admin\user\details.jsp
- Add below code in jsp for the custom field nickname.
<div class="exp-ctrl-holder">
<liferay-ui:custom-attribute
className="<%= User.class.getName() %>"
classPK="<%= (selUser != null) ? selUser.getUserId() : 0 %>"
editable="<%= true %>"
label="<%= true %>"
name="nickname"
/>
</div>
6 You have done Your work. Deploy hook.
7 Now Try to create one user and test functionality.
8 You require to put above code wherever you want to show custom field.
ease mail me if you find any problem in above tusharpatel88@gmail.com or comment below.
Comments
Post a Comment