XF 1.5 How to override actionAddThread in XenForo_ControllerPublic_Forum to attach extra data to thread?

Yugensoft

Well-known member
I want to add additional data that is attached to a thread. This is similar to the polls, which are separate data (xf_poll) which can be attached to a thread when it is created.

I have tried to do this with the standard class-proxy way, i.e. XFCP_MyExtra_ControllerPublic_Forum and then overriding and parent-calling in actionAddThread(). But the problem is I need to know the thread_id of the thread that it is created, to allow me to tie my new xf_my_extra row to the new thread. And I can't do this because the $thread variable is local to the parent function.

The only two solutions I can see so far is:
- Fully overriding actionAddThread, and copy pasting everything from the parent function. I really don't want to do this because I'm then overriding base XenForo code, which would cause upgrade/version problems.
- Editing actionAddThread in XenForo_ControllerPublic_Forum (same problem).

So does anyone know a better way to do this? Thanks!

Edit: discovered this:
https://xenforo.com/community/threads/get-id-of-new-thread-from-actionaddthread-in-my-class.29849/

So I guess I'll do that unless there is a better way.
 
Last edited:
Top Bottom