Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Additional fields in discussion

edited July 2008 in Vanilla 1.0 Help
Hi a need to add 2 additional fields to Discussion. I’ve already added 2 fields in LUM_Discussion database table (they are varchar fields) I’ve edited form in themes/discussion_form.php and addedt two additional textareas And have added them in library/Vanilla/Vanilla.Class.Discussion.php But they are not stored in database anyway. Where else should I add them to work properly?

Comments

  • added also in library/Vanilla/Vanilla.Class.DiscussionManager.php but when sqlbuilder builds sql request i get: ... t.CountComments as CountComments, t. as Field1, t. as Filed2, t.CategoryID as CategoryID, where should i add field names from database ?
  • thanks already found myself it was appg/database.php -)
  • in general, it's not a good idea to modify in any way the source files in the library folder, and even less the ones in the appg folder, which should never be modified.

    instead of modifying in appg folder, you should modify the correspondent file in the conf folder, which won't be overwritten when updating, etc.

    if you need to add more fields to a core class, maybe it's better considering writing a class extension and then setting the reference to that new class via the object factory (being this the last solution)

    there are extensions out there that add custom fields without having to modify the class. in fact, with a couple of delegates, you can hook a function to store the new field info when saving the discussion to the DB and another function to retrieve the fields values from the DB when displaying the discussion.

    hope it helps
  • Delegates seem to be the best choice to me here.
This discussion has been closed.