Is it possible to add another field named “Roles” that will be seen by the package “alanning:roles” to Create Account. - atForm.
Solution. It may be useful to someone:
Hello @samurajjack,
I think your
Accounts.onCreateUser(function(options, user){
var role = ['unselected'];
Roles.addUsersToRoles(user, role);
return user;
});
doesn’t work because at that time the user object still doesn’t exists into the users
collection and the call to Roles.addUsersToRoles
expects this. See these lines which is where the user ojbects are updated into the Meteor.users
collection.
As a workaround you could try to manually add a roles
field to the user object being created and initializing it with the list of roles you wish to assign the user. See also this SO answer