XF 2.0 Adding custom action to inline moderation actions panel

CMTV

Well-known member
Hi!

Is there a way to add my own custom thread action in inline moderation actions <select...>?
Screenshot_1.webp

My action is called actionSolve in extended Thread entity class and it requires custom special permission solve_threads to be performed.

I tried to add <option value="solve">Solve threads</option> in inline_mod_actions template and it predictably didn't work at all. It showed "No premission" error.
 
It's a bit more involved in that - bear in mind inline moderation actions are designed to be run on many items, not just single items. So it will need some additional code.

As of right now in Beta 6 you would have to run a class extension on the inline moderation handler that you wish to extend. In this case XF\InlineMod\Thread and the getPossibleActions().

If you look at that class, you'll see how the existing actions are defined. There are simple actions which are mostly defined inline and handle simple state changes. Then there are more complex handlers for much more intensive and involved operations like deleting, moving, etc.

That should get you started.

Look out in the next release for a new code event which can be used to extend the list of actions for a content type more directly.
 
Top Bottom