digitalpoint
Well-known member
So I have a table that I need to write stuff to when a new thread is created (very similar to how polls are created in a different table when needed)...
I extended the XenForo_DataWriter_Discussion_Thread class, and added my table/fields to the _getFields() method... more or less works well... it creates a record in my custom table with the new thread_id (exactly what I want to do), but all the other fields are just set as default (blank or 0).
The problem is I can't find a good place within the XenForo_ControllerPublic_Forum::actionAddThread() method to set my fields for my secondary table... it would need to be somewhere between the $writer object being created and the $writer->save(); method being called.
Maybe extend the $writer->preSave() method and do it all in there?
I extended the XenForo_DataWriter_Discussion_Thread class, and added my table/fields to the _getFields() method... more or less works well... it creates a record in my custom table with the new thread_id (exactly what I want to do), but all the other fields are just set as default (blank or 0).
The problem is I can't find a good place within the XenForo_ControllerPublic_Forum::actionAddThread() method to set my fields for my secondary table... it would need to be somewhere between the $writer object being created and the $writer->save(); method being called.
Maybe extend the $writer->preSave() method and do it all in there?