ModerationQueue Extend

Stepel

Member
Hi all,

I added option to ModerationQueue (one more than, delete, approve, nothing). Its 'moveToTrash'.

I extended ModerationQueueHandler for Post and for Thread. I modified template to add input:radio.
But SAVE BUTTON in Mod Queue call action "actionSave" in ControllerPublic\ModerationQueue.php

There is
Code:
$this->_getModerationQueueModel()->saveModerationQueueChanges($queue);

and in method saveModerationQueueChanges($queue) i had to add my code lines..to do "moveToTrash" action :(

Code:
else if ($change['action'] == 'moveToTrash') {
$handler->moveToTrashModerationQueueEntry($entry['content_id']);
}

It works as I want.. but I don't want to modify core files..:( What is the best way to do that ?

replace SAVE BUTTON action by different action and extend more classes ? :/
 
You could extend the saveModerationQueueChanges() by using XFCP and extending the XenForo_Model_ModerationQueue. You can then call the parent method, but it would have a caveat. Calling the parent method will first get all the content for populating moderation queues, but since it doesn't return the entries or anything, you'll have to query again to get the entries again and loop through the entries to trash. I would advise to clone the parent method and extend it without calling the parent function. This will work fine over minor updates but it might break over future major updates.
 
Do you mean that i should extend XenForo_Model_ModerationQueue by method which is called the same (saveModerationQueueChanges()) ? like overriding ?
So better solution is change controller action (in form in moderation queue, by "template modifications") example from ModerationQueue/Save to ModerationQueue/mySave

and extend then XenForo_Model_ModerationQueue by my own method
mySaveModerationQueueChanges($queue); ?
 
Ya, both ways would work, I can't comment which one is better cause it's just a matter of personal preference.
 
Top Bottom