留言板
Portlet for adding custom users
Archi Madhu,修改在11 年前。
RE: Portlet for adding custom users
Regular Member 帖子: 237 加入日期: 08-3-25 最近的帖子
Hello,
I think expando is good option for custom fields.
If we think about exporting custom user information from Liferay in future, if we create custom tables, we have to write our own logic to fetch out custom fields information.
Also, if we go for custom tables, we have to write lot of code for service builders and have to update the OOTB code to do CRUD operations while some one is saving user information, which is not a good practice and gives pain during upgrades.
As per me expando is good option and one should go for it.
HTH!
- Archi
I think expando is good option for custom fields.
If we think about exporting custom user information from Liferay in future, if we create custom tables, we have to write our own logic to fetch out custom fields information.
Also, if we go for custom tables, we have to write lot of code for service builders and have to update the OOTB code to do CRUD operations while some one is saving user information, which is not a good practice and gives pain during upgrades.
As per me expando is good option and one should go for it.
HTH!
- Archi
Charaf faceofjock,修改在11 年前。
RE: Portlet for adding custom users
Junior Member 帖子: 30 加入日期: 13-4-8 最近的帖子
With this , could i add differente portlets that include different forms according to which type of user i like to add ?
Have you some tutorials or good examples ?
Have you some tutorials or good examples ?
Apoorva Prakash,修改在11 年前。
RE: Portlet for adding custom users
Liferay Master 帖子: 658 加入日期: 10-6-15 最近的帖子Charaf faceofjock:
Hi ,
I would like to create some portlets for adding users with some custom fields , i saw this article here but i don't know if it's good or not , and if it's the best solution for liferay 6.1.
I have lunched a discussion before here but no answers.
Please help and thanks in advance
Hello Charaf,
Following is some rough code.
Adding New user
toReturnUser = UserLocalServiceUtil.addUser(0,getCompanyId(request), false, pswd, pswd, true,
StringPool.BLANK, getUserEmailId(request), 0,
StringPool.BLANK, getLocale(request),
getUserFirstName(request), StringPool.BLANK,
getUserLastName(request), 0, 0, true, 1, 1, 2000,
StringPool.BLANK, null, null, null, null, false,
ServiceContextFactory.getInstance(ServiceContext.class.getName(), request));
Saving Value in Expando:
ExpandoTable expandoTable = ExpandoTableLocalServiceUtil.getTable(getCompanyId(request), User.class.getName(), "expandoTableName");
if(expandoTable ==null){
expandoTable = ExpandoTableLocalServiceUtil.addTable(getCompanyId(request), User.class.getName(), "expandoTableName");
}
ExpandoColumn expandoColumn = ExpandoColumnLocalServiceUtil.getColumn(expandoTable.getTableId(), "columnName");
if (null == column) {
column = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(), "columnName", ExpandoColumnConstants.STRING);
}
ExpandoValue expandoValue = ExpandoValueLocalServiceUtil.addValue(themeDisplay.getCompanyId(), User.class.getName(), "expandoTableName", "columnName", groupId, "value to be saved");
HTH...
Thanks and Regards,
Apoorva Prakash
Charaf faceofjock,修改在11 年前。
RE: Portlet for adding custom users
Junior Member 帖子: 30 加入日期: 13-4-8 最近的帖子
Is expando the best Way to this task cause i'm trying to learn how to use service builder to add my addUser function with special fields
Apoorva Prakash,修改在11 年前。
RE: Portlet for adding custom users
Liferay Master 帖子: 658 加入日期: 10-6-15 最近的帖子Charaf faceofjock:
Is expando the best Way to this task cause i'm trying to learn how to use service builder to add my addUser function with special fields
Its always a good idea to use expando in case you want to add some custom fields with liferay existing entities.
nitin kumar sharma,修改在9 年前。
RE: Portlet for adding custom users
New Member 帖子: 12 加入日期: 13-4-26 最近的帖子
Hi Apoorva Prakash,
Thank you so much for sharing point to point solutions.
Thank you so much for sharing point to point solutions.