Fork me on GitHub
Current Releases are 2.1 stable (major release) and 2.0.18.11 (security patch for 2.0)
We've also rebooted our GitHub repo, docs, and more!

How-to use the UserMeta Table with my Plugin?

edited September 2011 in Developers
Hi there,

One of my Plugins is currently designed to add an extra row to the User DB-Table in order to save a custom user value. As I am assuming at the moment, this causes many troubles for users of my Plugin, because it will totally screw their Vanilla installation if this column does not yet exist in the DB-table.

I understood by following the development of Vanilla 2, that today there is a more "isolated" (sandbox?) way of doing this by using the UserMeta DB-Table. I did even look at some example plugins like EMailSubscribe and AboutMe, but honestly I didn't get rid of the DB integration they use.

Probably my problem is, that I "hack" today an additional filed into the existing /profile/edit/ popup (via "ProfileController_AddProfileTabs_Handler") and thus this automatically triggers the normal Profile-Save-SQL. Do I need to add my own Settings menu for a user, like it's done in the mentioned reference plugins?

Further, how does it work to write a user based entry to the UserMeta DB-Table and then read this value out when a) on this user's profile and b) read them all out for a global summary?

I would of course appreciate any hints to existing discussions, documentations, etc. as I was hopelessly lost when trying to search for myself :(

Thanks for any help guys!
Oliver

Best Answer

  • LincLinc Community Instigator Detroit Vanilla Staff
    Answer ✓
    To me, it looks like you are doing precisely the right thing in your plugin. Adding that column is fine; it won't "screw" an installation because it will always make sure the column is present during install or add it.

    You could indeed use UserMeta, but you don't have to if you don't want to.
Sign In or Register to comment.