Forums / Developer / Two user types, two registration forms. Not possible?

Two user types, two registration forms. Not possible?

Author Message

Nathan Kelly

Wednesday 21 September 2005 10:02:22 pm

Hi, I'm trying to create two different user types, one for generic users and one for stockists. I have created a "stockist user" class for the stockists and I have modified the "user" class a tad for my generic users.

When a stockist registers they should be placed in the "stockist" user group, likewise the generic users should be place in the "generic" user group. I have set the roles for my stockists to allow them to create, edit and delete their own outlet information as they choose, whereas the generic user group has no create, edit or delete functionality it is simply to allow them access to members only areas of the site plus receive news letters etc.

The registration process is somewhat different for each group, stockists will need to be approved before their account is activated, while generic users need no approval. Stockists should receive an email informing them of the approval process, whereas generic users will receive the standard confirmation email.

The information required from the stockist is significantly more detailed than that of a generic user. The generic user needs only a name, surname, username, password and email.

I have searched the forums extensively but it seems the idea of two registration forms is a problem a lot of people have faced with no real solution. I have considered creating a new site access to allow for the independent registrations but this just seems like a messy way to do things, there must be a more seamless approach to this common problem.

An extension may do the trick but I have zero knowledge of PHP so (for me) it is somewhat futile looking at such files when I have no idea how to interpret them. Besides that I just dont have time to learn a whole new language, this is partly the reason for choosing EzP in the first place I might add (look where that's taken me :( )

I would really appreciate any suggestions or solutions to this problem, and maybe if a solution is found it could be documented to save others this frustration.

Cheers!

<i>P.S. (Take this a critique, not criticism)
For such a powerful system as EzP, I seem to be finding that a lot of the functionality I expected to be "built in" seems to be either missing or unthinkably hard to implement. IMO EzP is having a hard time meeting the expectations set by the hype on the homepage. Its a shame.</i>

Pardon me while I burst into flames...

laurent le cadet

Thursday 22 September 2005 1:37:53 am

Hi,

I'm trying to perform this also and it's not so eZ because there is a lot of process regarding to validations, email, confirmation, activation...

The best way I found is to create a new extension based on the kernel>user and write some additional settings, something like this :

[AncienSettings]
GeneratePasswordIfEmpty=true
GeneratePasswordLength=6
DefaultAncienPlacement=316
DefaultSectionID=8
RegistrationFeedback=email
VerifyUserEmail=enabled
RegistrationEmail=
AncienClassID=45
AncienGroupClassID=2
AncienClassGroupID=2
UserCreatorID=316
HashType=md5_user
UpdateHash=true
AuthenticateMatch=login;email
RequireUniqueEmail=true
UseSpecialCharacters=false
LogoutRedirect=/ancien_eleve/login
LoginHandler[]=standard

You can have a look to site.ini for more explanation about the code above.

Apparently this solution works but need more fine tuning because it cause sometime confusion between the regular userand the custom one.

Hope this help.

Laurent

laurent le cadet

Thursday 22 September 2005 1:50:07 am

in addition you can read this : http://ez.no/products/ez_publish_cms/documentation/incoming/tutorial_using_user_register

Nathan Kelly

Thursday 22 September 2005 3:31:49 pm

Hi laurent, I have read that tutorial several times but it really doesn't cover multiple user types.

I thought the use of an extension would be the best idea but as I said, I have zero knowledge of PHP so writing my own extension is somewhat out of my depth.

Would you think that the dual siteaccess approach may be more stable? I'm pretty sure I could get it working with dual access though it seems like a clunky way to go about something so trivial.

I must admit I'm very surprised to find this functionality lacking in EzP, if I had of known EzP couldn't do this it would have changed my choice of CMS as this was a major point for the project (among other lacking features).

I'm staring to feel a bit silly about the choice now, o well!

Cheers!

Pardon me while I burst into flames...

laurent le cadet

Friday 23 September 2005 12:30:18 am

Hi,

Maybe you did the wrong choice if you need a CMS which deliver you a out of the box multi-users choice...
In fact eZp is a very complete solution and allowed you to do what you want by using it's functionalities and there is forums to help you ;) when you are stuck.
You know, I'm not a hard coder and my approche of php is close to 0.
But eZp can perform most of my needs if I spend time to learn a bit.

Anyway !

Your dual approche based on site acces doesn't seems to me to be useful.

There is minor things to do to make your own kind of extensions manually especially if it's already written ;)

- create a new folder in extension "myextension"
- create 2 subfolders "modules" and "settings"
- in "settings" create a file "module.ini.append" with this lines

#?ini charset="iso-8859-1"?

[ModuleSettings]
ExtensionRepositories[]=myextension

- In "modules" create a new subfolder "myextension" and copy/paste the whole content of kernel>user in it

- create a folder in yourdesign (plain ?)>templates>"myextension" and copy/paste the whole content of standard>templates>user

You'll have to modify the php files to call the templates you need so open them and look for this kind of lines :

$templateResult =& $tpl->fetch( 'design:user/activateaccountmail.tpl' );

In regiter.php replace the session variable "RegisterUserID" with "RegisterUserID_myextension" to avoid confusion between the 2 forms.

{* nearly the end ;) *}

Create you new user class in admin under user tab.

Copy/paste this in settings>override>site.ini.append.php

[myextensionSettings]
GeneratePasswordIfEmpty=true
GeneratePasswordLength=6
DefaultmyextensionPlacement=316
DefaultSectionID=8
RegistrationFeedback=email
VerifyUserEmail=enabled
RegistrationEmail=
myextensionClassID=45
myextensionGroupClassID=2
AncienClassGroupID=2
UserCreatorID=316
HashType=md5_user
UpdateHash=true
AuthenticateMatch=login;email
RequireUniqueEmail=true
UseSpecialCharacters=false
LogoutRedirect=/myextension/login
LoginHandler[]=standard

Mind to write our own IDs

Done.

It should have be better to make a real extension to install all this stuff with 2 clics but it will be a good approch of how eZp works.

regards.

Laurent

Nathan Kelly

Friday 23 September 2005 2:44:11 am

Cool thanks for the info laurent, I know I sound a little cynical of Ez now and then but I don't mean too, its just that the impression given from the info on the site seems to suggest all this is so easy when in fact it does take a little more work than I expected. Mind you having no PHP skills is no help either (if only I had time to learn that too ;) ).

I'll give your suggestion a go, the only thing that concerns me is that you said in your earlier post that sometimes it causes confusion between the standard and custom user, what do you mean by that exactly?

Cheers!

Pardon me while I burst into flames...