Forums / Developer / Registering a custom user

Registering a custom user

Author Message

Pål Øystein Carlsen

Tuesday 11 November 2003 6:08:49 am

I have created a custom user class. It belongs to the user group and have been given the user rights, but it is ekstended with adress, firm, etc etc.

I have overridden
-user/register.tpl
-content/datatype/edit/ezuser.tpl and updated my overide.ini file to the cusom_user class as described, but when I go to the /user/register site I only get the two buttons and a heading. What kind of loop should I use to get access to my custom_user class?

{section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)} Does not seem to work unless I use the standard user.

According to the tutorial: " The standard register template uses a pre-defined variable called {$content_attributes}. This is an array containing all of the attributes of your user class" Is this still valid when you create your custom class??

Any help would be greatly appreciated as I know a lot of you out there seem to be using customised users without any hazzle.

Regards

Eirik Alfstad Johansen

Tuesday 11 November 2003 6:50:33 am

Hi Pål,

I was actually wondering earlier this morning how one would go about accomplishing this. Can't say I know the answer, though.

However, wouldn't it be easier to edit the existing users class to fit your needs instead of creating a new one from scratch?

Sincerely,

Eirik Johansen
Netmaking AS

http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Pål Øystein Carlsen

Tuesday 11 November 2003 2:45:37 pm

Well, you are probably right, but that is simply postphoning the problem. I will need customised users later on.

Is there anyone else who has any experience with this? I have tried searching the forum and read a lot of threads, but nothing concerning exactly this...

Paul Forsyth

Wednesday 12 November 2003 2:21:30 am

Have you read further into the tutorial about telling ez about your new user class, eg:

After creating your new user class make sure this setting has the correct user class id

UserClassID=NEW_CLASS_ID

I wrote this article after hitting the same problem again and again. You do need to inform ez that the class has changed. Then when you register it will use the information from that class to populate $content_attributes

paul

Pål Øystein Carlsen

Wednesday 12 November 2003 2:29:41 am

Well yes I have and I have changed my site.ini.append in settings\siteaccess\mysite folder to this:
[UserSettings]
RegistrationEmail=enabled
UserClassID=custom_user
DefaultUserPlacement=53

(the defaultuserPlacement=53 works, it puts my new registered users in a specific user group)

This is correct isn't it?

Paul Forsyth

Wednesday 12 November 2003 2:31:49 am

I assume you have a class id in this statement:

UserClassID=custom_user

paul

Pål Øystein Carlsen

Wednesday 12 November 2003 2:50:14 am

Ehm, what do you mean by that?

I have a class called Custom User, it has ID = 17, and identifier custom_user which I assumed was what i was to put into the ini file. This is correct or am I wrong?

The custom_user is a member of Users so therfore I have not entered UserClassGroupID=17 to the ini file but I will try it anyway, I am getting frustrated

Thanks for your help so far. Any thing else I need to think about? I have also remembered to add a useraccount datatype to my class so it should have everything it needs.

Paul Forsyth

Wednesday 12 November 2003 3:04:30 am

Try:

UserClassID=17

Im not sure if identifiers work in the ini files. I haven't used them but i may be out of date here :)

You shouldnt need to change your group id. This should only change if your new user is in a different location other than the default 'Users'.

Try this and see if it works. If it doesn't... look at your overrides in the admin interface, under setup/templates. This should confirm if your overrides are in place for your other files.

This is the first time i've had a comment about the user/register tutorial. Please feel free to say what you think. It was written quickly and probably would benefit from a dusting down.

paul

Pål Øystein Carlsen

Wednesday 12 November 2003 3:23:40 am

To bad, but this didn't do the trick either. I have tried inserting debug statement
{section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)} test1 inside the loop section but it does not get printed, so it still seems like it has something to do with making this run.

everything above the loop gets printed.

And yes I override both
user/register.tpl
content/datatype/edit/ezuser.tpl if that was what you where asking

Paul Forsyth

Wednesday 12 November 2003 3:30:17 am

ok, try debugging $content_attributes.

Count: {count($content_attributes)}

Items:
{section loop=$content_attributes}
{:item|attribute(show)}
{/section}

Hopefully this will say how many attributes there are, and if the right class is being used.

paul

Pål Øystein Carlsen

Wednesday 12 November 2003 4:38:39 am

I think we are getting at the core here. The output of that code snipet was:
Count: 0
Items:

I inserted it above the {section} doing the loop.

Any ideas on what to do now? obviously $content_attributes does not contain anything and thus nothing happens.

Paul Forsyth

Wednesday 12 November 2003 5:00:43 am

Have you given role permissions to your user for the new user class?

If this doesn't work try switching off your overrides for user/register and edit the original user/register template itself within design/standard.

Put in the code snippet again and see what happens.

With the changes in site.ini ez should still try to use the new user.

Paul

Paul Forsyth

Wednesday 12 November 2003 5:03:30 am

Another test. Change the user class id back to the original. Does the code snippet work?

paul

Claus Jensen

Wednesday 12 November 2003 5:20:05 am

Hello people,
I think this sounds like the problem I have too. Have you looked at this?:
http://ez.no/developer/ez_publish_3/forum/general/class_attributes_gone_when_editing_class
and the bug i have registered?:
http://ez.no/developer/ez_publish_3/bug_reports/class_attributes_gone_when_editing_class

I tried to customize the user class. Any resemblance with this?

regards,
claÜs

Pål Øystein Carlsen

Wednesday 12 November 2003 6:28:41 am

I don't understand anything anymore.

I removed the overrides as you said, and have also removed the site.ini.append section, but now this has the same problem to. I have of course deleted cache files.

This worked earlier!! There has to be something funny going on here.

Edit: after a while it suddenly worked again with the "original" settings.

Ok, just to make sure, how do I make my custom_user the default new user, and assign it to a custom User group( In my system kalled user lvl 1 with id:53)
site.ini.append file is edited like this right?
[UserSettings]
DefaultUserPlacement=53

It works for standard users which is added to that user group.

Finally. I have added a cusom_user via the admin view. When I logg in with this user and go to the user/register page it shows me all the information about the user without problem.

Paul Forsyth

Wednesday 12 November 2003 6:46:18 am

If i read you right you have went back the normal user and can direct the location of where it is located to underneath a specific directory. If you add:

UserClassID=17

Does this mean when you goto user/register you now see all of the right information about your new user?

Pål Øystein Carlsen

Wednesday 12 November 2003 8:38:30 am

Well, I have now returned to original settings, but when I add UserClassID=custom_user or UserClassID=17 to my ini file I still get a new registered user as User, not custom_user

Paul Forsyth

Wednesday 12 November 2003 8:53:43 am

Hmmm, pretty odd. Changing that value should mean you see a registration screen for your new user.

Im stuck about what to suggest next. If your ids, role permissions and cache are all correct then it should work.

paul

Pål Øystein Carlsen

Wednesday 12 November 2003 10:13:13 am

Yes I know the feeling :)

I assume my role permissions are ok because if I logg in with the user I created in the admin screen I get access to all sections, as I was ment to have.

Other than that??? I am stuck in the mud :-(

Claus Jensen

Thursday 13 November 2003 3:41:07 am

Hello again,
I know I have written this before, but you have not commented on it so I write it again. I think this is a bug in ezpublish. Im using 3.2-1, and have a problem with class attributes not showing when I have edited the user class. When I try to make a new user after that, ezpublish will not show attributes from this class. Im almost sure this has to do with the same bug. If you look into the database and the spesific table ezcontentobject (i think) by using i.e. phpMyAdmin, you will see that the attributes are still there, and the data as well, but ezpublish still are not showing it. This also is the case with my own custom content classes. I believe this is a task for ezsystems to solve, I refer to my earlier post in this thread.

Anyway, nobody is commenting on my post or the critical bug this is and that is frustrating.

regards,
claÜs