XF 2.1 [SOLVED] Check if a column exists in a table

asprin

Active member
My addon will be using the credits/vcash feature from other some other addons (to my knowledge, there about 2-3 addons that add this feature). The basic idea is to know which column in the xf_user table does the addon store the vcash/credit value. In order to do this, I've added two fields as part of my addon options like below:
1581078660787.webp

Now whenever I want to modify the value in this column, I feel it's best to validate the existence of the column first (because the site admin may not always be accurate with the words/spelling of the column) before running the update query on the table/entity.

So is there a valid way to check this from my addon's controller? Can I directly use the $db object to do a SHOW COLUMNS query or is there a more effective to do that?
 
Back
Top Bottom