Forums / Developer / New user type
David Santiso
Saturday 02 April 2011 8:44:48 am
Hi,
I want to create a new user type. This user will not be a person. It will be a institution. I want that users can choose whether to register as a person or institution.
I've thought to create a new user class called institution, but when I create the class, how can I do to allow users to register using this class?
Thanks,
David
paul bolger
Saturday 02 April 2011 7:37:44 pm
Hi David,
The magic datatype which makes a content class accept user registration is User account [User account] (id:12). Any content class which includes that will be able to act as a user account. The unique identifier for a user account is an email address. You can't use the same address for more than one account, and the person using the registration will need to be able to receive mail on that address to reset their password. Also, any other person who can read mail sent to that account will be able to reset the password.
Hope that helps.
Paul Bolger
Sunday 03 April 2011 6:26:41 am
Yes, yes.
The new class of user is a copy of the user, but adding some more data. I want each user can choose which type of register making. Obviously there will be only one register per mail.
When I have created the class, how would I proceed?
Carlos Revillo
Tuesday 05 April 2011 4:39:37 am
The unique identifier for a user account is an email address. You can't use the same address for more than one account, and the person using the registration will need to be able to receive mail on that address to reset their password. Also, any other person who can read mail sent to that account will be able to reset the password.
Hi Paul. That's not entirely correct. eZ Publish allows to have several users sharing same e-mail address. not by default, but it's just a matter of modify a setting
have a look at https://github.com/ezsystems/ezpublish/blob/master/settings/site.ini#L587
username (nick) must be unique always, but in sometimes several "users" can share email account.
Cheers.
Tuesday 05 April 2011 4:43:40 am
Hi David.
If you're doing it via /user/register, then you can modify (override) a setting found in site.ini file
https://github.com/ezsystems/ezpublish/blob/master/settings/site.ini#L553
You can set that to the id of your new class.
But for choosing, you'll probably need a custom module. i suggest you start from the provided one and add there the modifications needed to create a object of the class you want depending on the user selection.
Wednesday 06 April 2011 3:57:17 pm
Hi Carlos, I must admit that I didn't know that.
Generally, and I'm starting a project where this is relevant, I'm interested in the relative merits of extending the user content class to make a 'people' directory versus creating a new class. Is there any good reason why extending the user class would not be a good idea?