Fórum

custom field in user profile

Pradnya Bhoye, modificado 8 Anos atrás.

custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Hello every one,
I have created custom field in user profile that is location..by control Panel->custom field .
Now this custom field is added to Control Panel->My Account->Custom field. Now i want to add it to database ..For above i need to make hook..I don't know which jsp i need to override and what is the next procedure for that..Can anyone will help me or suggest me any solution.
Thanks in advanace.
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
Um, no you don't have to "add it to database".

Custom fields, when defined for the User entity, are already stored in the database. It's all handled for you.
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Thanks for your reply David..
Then how it gets stored in database can you explain? Because i want to retrieve the value in one scenario which is mentioned below.

Scenario::Already there is one custom field "Office" which is dropdown list ..the default values for office already given like USA,Japan..Now if user will select the office="USA" then location field should be automatically populate with "USA",. I don't know how to solve this
thumbnail
Harish Kumar, modificado 8 Anos atrás.

RE: custom field in user profile

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi

Custom fields are stored in expando* tables

expandorow
expandocolumn
expandotable
expandovalue

you can make use of user.getExpandoBridge().getAttribute("attributeName") to get the custom field value.

Regards,
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Thanks Harish,yes, I saw the location attribute in expandotable,expanadocolumn.
I need to get one custom field value to another custom field (location textfield in jsp)
thumbnail
Harish Kumar, modificado 8 Anos atrás.

RE: custom field in user profile

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
I need to get one custom field value to another custom field (location textfield in jsp)


Could you please explain this. do you want to get the value of location custom field .
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
I do have one custom field already in user profile that is "Office" which is list like USA,Japan(set by default).
Now i have created another custom field "location".
If user will select office="USA"...
Automatically location will be populate to "USA" (which is not editable by user).
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
Now you're getting into details, context which you haven't supplied before.

The short answer is you cannot. Each custom field is it's own entity and they do not have any impact on each other.

Long answer is you could, but you'd have to code around it. I would probably go with a model listener to intercept the before create/before update methods. You can interrogate the value for office and set the value of location. Would probably be the least intrusive way.

But the question is, if it is a one to one mapping like that, why do you need the location value anyway? If office=usa, you know that location must be usa so there's no reason to make it another value.
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
David,Your answer is very much helpful to me. and your question is valid. I will definitely think on your question.
Thank you so much for instant reply..
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Hey David, Can you guide me.
You have asked me that if I am having office "USA" then why I require Location, I want Location(Custom field) for asset publisher,So that i can use it in asset publisher's custom attribute.
1)If "Office"(custom field) which already stored in database. now i just want that office value for respective user in "Location"(custom field).
In short I want office value from database in Location field. Can you guide me for above
thumbnail
Sandeep Nair, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
On a completely different note seeing your problem, I wouldn't design it this way using custom fields.

Looking at your description I think what you require is you basically want to tag or categorize content created in asset publisher based on the country of the user. If that is the case I would use the User's contact country(may be mandated) to tag or categorize the content dynamically.

Again my understanding may be wrong or the approach based on my understanding. Just my two cents.

Regards,
sandeep
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Thanks Sandeep.
Yes exactly, You got my point I just want to categorize the assets on the basis of user's location.. U were saying that u will use the User's contact country(may be mandated) to tag or categorize the content dynamically. ..But we don't have that much countries for office location..suppose if we are having 4 location(USA,INDIA,JAPAN,CHINA) then for user who is belonging from USA will only see the assets of USA location not of INDIA location..

I was prefering below link..
https://issues.liferay.com/browse/LPS-19681
but First I want to do below thing

1)If "Office"(custom field) which already stored in database with values. now i just want that office value for respective user in "Location"(custom field).
thumbnail
Sandeep Nair, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Hi,

As mentioned in JIRA did you follow the steps. It seems straight forward. Create the custom attribute, create the vocabulary and then in Asset Publisher's configuration there will be option "Custom User Attributes". Specify the name of the custom attribute that you already created.

Honestly, I didnt know Liferay provided this functionality. Seems useful.

Regards,
Sandeep
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Thank You Sandeep.
As mentioned I followed all the steps correctly..But still asset publisher shows all the assets. it's not filtering the assets.
thumbnail
Sandeep Nair, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Hi Pradnya,

Please find the steps below

Step 1-2 - Create Custom Field & Set view permission (See step1.png has two steps side by side)
Step 3-4 Add vocabulary and category in Global scope and Create content and categorize it according to location(See step3-4.png has two steps side by side)
Step5 Add custom attribute for a user (step5.png)
Step 6 Set the configuration of the asset publisher as shown in screenshot(step6.png)
Step 7 Login with specific user and you should see the filtered results

Note: I have 6.2CE Ga3 and it has a bug that user who doesnt have the Custom attribute set sees all the content. (https://issues.liferay.com/browse/LPS-42325)
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Thank You Sandeep for your valuable explanation.
Still I am facing the problem asset publisher not filtering the assets according to location.
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Hey Sandeep Thanks.
Its working fine..emoticon
Pradnya Bhoye, modificado 8 Anos atrás.

RE: custom field in user profile

Junior Member Postagens: 70 Data de Entrada: 14/11/14 Postagens Recentes
Hey David, Can you guide me.
You have asked me that if I am having office "USA" then why I require Location, I want Location(Custom field) for asset publisher,So that i can use it in asset publisher's custom attribute.
1)If "Office"(custom field) which already stored in database. now i just want that office value for respective user in "Location"(custom field).
In short I want office value from database in Location field. Can you guide me for above
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: custom field in user profile

Liferay Legend Postagens: 14915 Data de Entrada: 02/09/06 Postagens Recentes
Pradnya Bhoye:
Scenario::Already there is one custom field "Office" which is dropdown list ..the default values for office already given like USA,Japan..Now if user will select the office="USA" then location field should be automatically populate with "USA",. I don't know how to solve this


When you define the custom field you have many different choices as to it's definition. One of those options is a text box, but that won't really help you much.

There's other options where you can specify the list of values that can be picked from. You can enter them as USA, Japan, etc. Person making the change in the user admin would only be able to pick from the available values and, when some other portlet/hook/whatever went for the value, they would get the ones that you allow.