What happens to the custom field I made when nodeBB is updates



  • I made a theme of my own based on the persona theme. I created new custom fields on the user profile, e.g. zodiac sign, personality, favourite movies, etc. For these fields to be saved I also changed the files:

    • profile.js in nodebb/src/user/profile.js. To be precise I changed the function User.updateProfile
    • edit.js in nodebb/public/src/client/account/edit.js. To be precise I changed the function updateProfile.

    These functions in the files mentioned above are responsible for saving the field information of the user profile.

    What happens if nodeBB is updated and I have to update my nodeBB? Will the changes I made in edit.js and profile.js be gone and I have to write them again? How do I add custom fields in the user profile in a way that is "update friendly", meaning that if I have to update nodeBB I don't have to think about changing the profile-update-function?


  • Global Moderator

    Yes, when you update NodeBB, those changes would be erased. This is why it's recommended that you implement your custom fields and things with a custom plugin.



  • Is it recommended to add the custom fields in a theme but implementing the functions for saving the custom field value as a plugin?


  • Global Moderator

    @Thadeusz-Lay technically the functionality of themes and plugins is interchangeable. You can add the things to your theme if you want, no need to add an extra plugin. It's up to you.


  • Admin

    IMO make those custom fields a plugin. This way others can also use your functionality if they want, and even better for you if they add more things to it.

    On the other hand, keeping it in one codebase is probably easiest for you. Up to you! :)



  • @psychobunny said in What happens to the custom field I made when nodeBB is updates:

    IMO make those custom fields a plugin. This way others can also use your functionality if they want, and even better for you if they add more things to it.

    Why can't they use and extend my functionality in my theme? Why does it have to be in a plugin?


  • Plugin & Theme Dev

    @Thadeusz-Lay coz they may not want to use your theme. Making it a plugin will enable anyone to use it with any theme. If you want to keep things simple and don't want to publish your theme with custom fields, then you can add the fields in the theme.


Log in to reply
 


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