How to add fields to the users?
I would like to add fields to the user registration!
The registration only ask for and user name & email.
I try but I can't do it :S
[UPDATE]
What i try is adding fields in the registerUser.coffe :
userData = email: formData.email password: formData.pass lastname: 'lastName'
But it does not work :S, I get an error on meteor terminal:
Error: A method named 'registerUser' is already defined at livedata_server.js:1542:15 at Function..each..forEach (packages/underscore/underscore.js:113:1) at [object Object]._.extend.methods (livedata_server.js:1538:7) at Object.Meteor.methods (server/lib/debug.js:33:2) at server/methods/registerUser.js:2:1 at server/methods/registerUser.js:22:1
@RocketChat/core what do you think about this issue?
@elgriego,
Actually, userData (where you're trying to add the lastname) is passed to Accounts.createUser which is a meteor function and which won't save extra data.
Just have a look a bit below, I think you can do something like: RocketChat.models.Users.setName userId, formData.name
We should have a way to define extra fields for the registration form (similar to the settings?), but I can imagined it getting much more complex very soon, as admin will want to configure validations, etc.
But I agree, we should have some easy way to add more fields.
Related: #2046
related #2048
@RocketChat/core I'm working on this issue with @nazclarion. We're wondering where in mongo is the best place for user field extensions - A) in the user document, B) nested in a property of user (like custom-fields), C) in a seperate collection?
I’m not sure what that means for migrations with different versions / branches. If we populate custom fields then build a version that doesn’t have this package, are there DB migrations that would remove the changes?
Speaking of validations etc, I'd like to work towards a more unified approach to encourage consistency with admin controls and settings pages, which is kinda lacking at present. I've looked into how other Meteor projects do that and found a possible approach, using a few packages together to provide schemas for auto-building forms. Maybe there's some packages already doing this? e.g.
aldeed:simple-schema combined with aldeed:collection2. Then possible to also use aldeed:autoform to generate form UI straight from the collection schema, no template markup required.
OR
More manual, less prescriptive approach could just be providing a front end validator to all packages, something like Parsley.js.
Thoughts?
It would also be useful to have these "About me"/"Role" fields be searchable from a system-wide search feature that searches among all chats and user profiles, so that I could search for expertise within my organization using the search feature.
I would also like this feature, synced from ldap. Essentially, the additional fields could be added to 'User Data Field Map' under Admin -> LDAP. Any hints on where to start?
@cbrummitt, @VirtuaCreative, @estadtherr, @meilinger, @joetm, @Schoaf, @svenschumacher, @gongled, @jcardila @acaronmd lets use this issue to track your request from https://github.com/RocketChat/Rocket.Chat/issues/2046
@timkinnane and @rodrigok can we have a chat about this on our demo server?
I agree it is needed, together with #2135 :)
Add fields in registration process was done here https://github.com/RocketChat/Rocket.Chat/pull/4073
+1
@RocketChat/core is there anything needed done on this? From what I can tell #4073 should have resolved this.
@geekgonecrazy Documentation on how it works and how to use it.
https://github.com/RocketChat/Rocket.Chat.Docs/issues/221
Hey, i'm trying to add some customFields using the api/v1/users.update method.
It seems that my HTTP calls are successful (e.g. i'm managing to update the "name" field; or add complete new users). nonetheless, it seems that i can't update (or add) customField - as it doesn't appear in the user data on mongoDB.
var options = {
url: url +"/api/v1/users.update",
method: 'POST',
headers: {
"X-Auth-Token": credentials.authToken,
"X-User-Id": credentials.userId,
"Content-type": "application/json"
},
form: {userId: userId, data: {customFields: {twitter:"something"}, name: "ido try"}}
}
request(options, function(err, res, body) {
var bodyParse= JSON.parse(body)
console.log(bodyParse)
})
@shaharido1 I'm having the same problem. Were you able to resolve this?
have you guys correctly configured the Custom Fields under Administration > Accounts > Registration?
@sampaiodiego I have not. I just added the fields manual to my document i.e.
"_id" : "Giek2324dsd", "customFields" : { "situation" : "I was hurt by a person.", "amount" : "50", "isShowing" : false }
So I have to add the custom fields in the admin section and then the API (users.update) will work?
Syirrus