Best Way to Add Metadata to Thread

Let's say I have a forum that discusses Restaurants and I want each thread to be tagged with a name of a Restaurant that the thread is about. Now what's the best way to go about adding this data? I don't want to use prefixes because there will be 2-3 different such fields so prefixes are not an option.

Basically I believe there are two options:
  1. Edit the thread table by adding the field and then extend its model and controller so that restaurant_id is included in each usage of Thread.
  2. Create a new table such as MyAddon_ThreadMetadata and put thread_id, restaurant_id, etc into that.
Which will be the preferred way to go about this task? Keep in mind I want to be able to search on threads that are tagged with the restaurant_id also, so basically I want the solution to be as flexible as possible.

Mike Tougeron

Well-known member
I would create a new table for the thread metadata. You could then extend the XenForo_Model_Thread class to have the queries join that table for the data or you could call another method to get that data and assign it to the view.