Extending Rainlab.User

I am working on a plugin which needs some additional fields on the Rainlab.User Model.
I have found two possible way to do this:

  • Adding fields to the model by injecting it from my Plugin
  • Creating my own profile model with all my custom fields and creating a 1:1 relationship with the Rainlab.User Model

Which one of those is preferable, or what are possible effects for further development when choosing one over the other?

The things that come to my mind are maybe easier queries if all fields are in the same table but better separation of my custom data with third-party plugins.

Anybody got any tips, experience, ideas or thoughts about this?

We went with the second option in the OFFLINE.Mall plugin (the model is called “Customer”).

If you just need to add a few fields and maybe an accessor or two, I’d go with the original model as long as possible. Only introduce the realtion if it really makes things easier as juggling the Customer/User models in our case was quite a hassle sometimes (especially during signup).

1 Like

Thanks for your insights!