Grabbing the Conversation Message in _postSave() When Warning Issued.

Brent W

Well-known member
I am trying to do this with my new add-on but I am having problems figuring out how to grab the conversation message. _postSave() doesn't appear to have access to it in anyway. XenForo_Member::actionWarn has the variable $conversationInput['conversation_message'] available but I don't see how I can get it into _postSave() to use. Any ideas?
 
You probably can't get the Warning DW to become "aware" of the conversation process.

A quick look tells me that you might only be able to do what you want by extending the controller. This is far from ideal, and may take some doing, but I think it should be possible.

Side note, XF2 structures things like this in a much better way by structuring such processes into a "Service" object. Doing what you want to do is likely to be a lot easier there (I know that doesn't help you right now, but, one day ;)).
 
You probably can't get the Warning DW to become "aware" of the conversation process.

A quick look tells me that you might only be able to do what you want by extending the controller. This is far from ideal, and may take some doing, but I think it should be possible.

Side note, XF2 structures things like this in a much better way by structuring such processes into a "Service" object. Doing what you want to do is likely to be a lot easier there (I know that doesn't help you right now, but, one day ;)).

It isn't a deal breaker so I can wait for XF2 for that part. It will make our moderators happy to eventually have that information though.
 
I am trying to do this with my new add-on but I am having problems figuring out how to grab the conversation message. _postSave() doesn't appear to have access to it in anyway. XenForo_Member::actionWarn has the variable $conversationInput['conversation_message'] available but I don't see how I can get it into _postSave() to use. Any ideas?
You need to jump through some hoops. Look at my Warning Improvements which allows conversation emails to be send even to banned users when a warning is issued.

Post Save capture of the warning data writer:
https://github.com/Xon/XenForo-Warn...ements/XenForo/DataWriter/Warning.php#L51-L58

Intercept before the conversation is dispatched, and force it to be sent if they are banned or not:
https://github.com/Xon/XenForo-Warn...ngImprovements/XenForo/Model/Conversation.php

Or you can just extend the conversation writer and do something if the tracking variable is set.
 
You need to jump through some hoops. Look at my Warning Improvements which allows conversation emails to be send even to banned users when a warning is issued.

Post Save capture of the warning data writer:
https://github.com/Xon/XenForo-Warn...ements/XenForo/DataWriter/Warning.php#L51-L58

Intercept before the conversation is dispatched, and force it to be sent if they are banned or not:
https://github.com/Xon/XenForo-Warn...ngImprovements/XenForo/Model/Conversation.php

Or you can just extend the conversation writer and do something if the tracking variable is set.

Thanks!
 
You need to jump through some hoops. Look at my Warning Improvements which allows conversation emails to be send even to banned users when a warning is issued.

Post Save capture of the warning data writer:
https://github.com/Xon/XenForo-Warn...ements/XenForo/DataWriter/Warning.php#L51-L58

Intercept before the conversation is dispatched, and force it to be sent if they are banned or not:
https://github.com/Xon/XenForo-Warn...ngImprovements/XenForo/Model/Conversation.php

Or you can just extend the conversation writer and do something if the tracking variable is set.

This add-on helped me understand a bit more about XenForo and Object Oriented programming. Thanks again.
 
Ok, so I have extended DataWriter_Warning::_postSave and DataWriter_ConversationMessage::postSave and now have conversations appearing in my threads that are created.

The problem is that if I send a warning without a conversation then no thread is created at all because my code to create the thread is inside the ConversationMessage::_postSave which is not run.

A warning thread should be able to be created regardless of there being a message sent or not.

Not sure how I can cover both scenarios and still get the warning thread created...
 
Last edited:
Back
Top Bottom