Extend user module with additional fields and functions



  • Hi guys,
    I want to extend the USER module to 2 purposes:

    • add additional fields
    • make relationship as well as actions like CRUD, make my project specific functions with users
      So I am considering these options below:
    1. overwrite USER module (which make me not able to update CMS anymore)
    2. Add more fields into users table, and use event to update and show the additional fields (Not sure that event can help for all cases)
    3. Create new module (ex: PROFILE module) which has additional fields and I can easy to make my specific functions because I have my own controller, repository, model so that will let the core USER module untouched. But this will make the relationship more complicated, and the query need to joined more table.

    The above options have pros and cons. Therefore, I need your help to determine which is best practice to extend user module in AsgardCMS.

    Thank you very much,

    An Vo


  • Global Moderator

    Hey,

    It all depends on how much and what kind of functionality you would like to add.

    For something like extra fields and mild modification the extension of a User module is the way to go.
    Relationships in this kind of approach are really no different for the most part as any other relation (you have profile relation on user and user relation on profile).
    You can even rewrite some of User files through route overriding (like registration logic etc.).

    Obviously, most freedom would be using your own fork of User module ( you can update cms just fine, except you will have to manually update your forked User module).

    Events approach is most frustrating to deal with, to be honest, would not recommend that.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.