cclaerhout
Well-known member
I would like to modify the datas sent when a user creates a post or reply to one before they are registered inside the Database.
I see two ways of doing it: extend the controller or the datawriter. P.S: I don't want to override the function, but to extend it.
#Controller solution?
Is there a way to call the parent function and modify it without saving twice the datas inside the db?
#Datawriter solution?
Can I modify the message content from here?:
Any advices will be welcome
Edit:
It seems I should be able to play with $this->_existingData['xf_post']['message'] from _messagePreSave() function.
Edit2: failure of previous edit
Edit3: Seems I need to play both with $this->_existingData['xf_post']['message'] AND
$this->_newData['xf_post']['message'];
I see two ways of doing it: extend the controller or the datawriter. P.S: I don't want to override the function, but to extend it.
#Controller solution?
Is there a way to call the parent function and modify it without saving twice the datas inside the db?
PHP:
function actionSave(){
$parent = function actionSave();// => save first
//... my code
// => datawritter => save twice... not good
#Datawriter solution?
Can I modify the message content from here?:
PHP:
/**
* Designed to be overridden by child classes
*/
protected function _messagePreSave()
{
}
Any advices will be welcome
Edit:
It seems I should be able to play with $this->_existingData['xf_post']['message'] from _messagePreSave() function.
Edit2: failure of previous edit
Edit3: Seems I need to play both with $this->_existingData['xf_post']['message'] AND
$this->_newData['xf_post']['message'];