XF 2.2 Generate thread title based on custom thread fields?

zackw

New member
We have certain thread "types" which have a handful of custom thread field questions. The only issue is that these threads need to follow a standard thread title convention. For example "FOR SALE: $50 - Short item descriptions here".

This thread title could be generated dynamically by the answers they give in the custom fields. A field for "price", a field for "Short description". Then I could easily create the thread title from these values.

Is there a way to do this which is also based on the thread prefix? If I have a prefix called "For Sale", which also is a thread that shows the custom fields, the only thing missing is auto-generate the proper thread title.
 

zackw

New member
That would require custom development.

Yes of course, but there is little documentation about development of addons or how to hook into events or override things, etc.
If I could hook into the process of creating a new thread, I could see if it uses my prefix, and if so, check the custom fields, and change the thread title.

But I can't find docs about creating plugins, hooking into thread creation, or what are the available classes and objects I can access data with.
 

JustinHawk

Well-known member
We have certain thread "types" which have a handful of custom thread field questions. The only issue is that these threads need to follow a standard thread title convention. For example "FOR SALE: $50 - Short item descriptions here".

This thread title could be generated dynamically by the answers they give in the custom fields. A field for "price", a field for "Short description". Then I could easily create the thread title from these values.

Is there a way to do this which is also based on the thread prefix? If I have a prefix called "For Sale", which also is a thread that shows the custom fields, the only thing missing is auto-generate the proper thread title.
You will need to extend this function setupThreadCreate in file XF\Pub\Controller\Forum.php using class extensions to achieve what you need.
But I can't find docs about creating plugins, hooking into thread creation, or what are the available classes and objects I can access data with.
Here is the documentation available : https://xenforo.com/docs/dev/lets-build-an-add-on/
 
Top