Forums / Developer / extending ezUser so on profile changes can be checked

extending ezUser so on profile changes can be checked

Author Message

Douglas Hammond

Thursday 28 May 2009 1:10:05 pm

I have extended the login handler.

Now after a user logs in, it seems ezpublisher no longer uses my cutom user class as when I change the user info, the overrided store function does not fire.

How do I get ezPublish to use my custom user class, not just for logging in?

Paul Forsyth

Thursday 28 May 2009 2:25:08 pm

Hi Douglas,

Have a look at this extension with a login handler:

http://projects.ez.no/superuser

and compare with your own. It may highlight something with your own code.

Paul

eZ Systems

Douglas Hammond

Friday 29 May 2009 5:54:46 am

Thanks but that part I got.

It is using an extened ezUser class to override the default ezUser class that I would like to do. When the ezUser is updated or modified i wan to catch the events to do some more logic.

Seems like the only wayt to do it is to modify the kernel source of ezUser. I would hate to have to do that and miss out on any changes in the upcoming releases.

Paul Forsyth

Friday 29 May 2009 6:13:17 am

Hi Douglas,

I hear you. Yes, the login handler only covers the loginUser function, which you can see from kernel/user/login how the correct class is loaded.

You have a few options in order to keep maintenance low. You could copy the ezuser datatype into an extension but that is a high maintenance approach.

I would patch ezusertype, specifically the function 'objectAttributeContent' which loads the ezuser object. Instead you could check for your new class and use that instead. That should force the correct object to be used, and therefore the right 'store' method.

Patching, if done properly, is a perfectly acceptable technique for modifying the kernel.

It should be very easy to maintain this patch. It depends. I can't see the ezusertype::objectAttributeContent method changing much in the future...

Paul

eZ Systems