Extended DataWriter Not Firing?

Gossamer

Active member
I'm trying to extend the _postSave() function for posts. My goal is to add a value to the user record every time they make a new post.

However, it doesn't look like my extended DataWriter is firing at all. I have a listener that is firing off other extended codes properly. I'm not sure where I've gone wrong with this one though.

Listener
PHP:
    public static function loadClassDataWriter($class, array &$extend)
    {
        switch($class)
        {
            case 'XenForo_DataWriter_Forum':
                $extend[] = 'Goss_RoleplaySystem_DataWriter_Forum';
                break;
            case 'XenForo_DataWriter_User':
                $extend[] = 'Goss_RoleplaySystem_DataWriter_User';
                break;
            case 'XenForo_DataWriter_DiscussionMessage_Post':
                $extend[] = 'Goss_RoleplaySystem_DataWriter_DiscussionMessage_Post';
                break;
            case 'XenForo_DataWriter_DiscussionMessage':
                $extend[] = 'Goss_RoleplaySystem_DataWriter_DiscussionMessage';
                break;
        }
    }

DiscussionMessage.php
PHP:
class Goss_RoleplaySystem_DataWriter_DiscussionMessage extends XFCP_Goss_RoleplaySystem_DataWriter_DiscussionMessage
{
    protected function _postSave()
    {
        parent::_postSave();
       
        $this->_updateUserPostsForActivity();
    }
   
    protected function _updateUserPostsForActivity();
    {

        $this->_db->query('
            UPDATE xf_user
            SET rp_messages_for_activity = 12345
            WHERE user_id = ?
        ', $this->get('user_id'));
    }
   
}

Any ideas what I might be missing?
 
I've updated it to _messagePostSave, but it still doesn't seem to be running:

PHP:
protected function _messagePostSave()
{
parent::_messagePostSave();

$this->_updateUserPostsForActivity();
}

protected function _updateUserPostsForActivity();
{

$this->_db->query('
UPDATE xf_user
SET rp_messages_for_activity = 12345
WHERE user_id = ?
', $this->get('user_id'));
}
 
Thanks! I switched from DiscussionMessage to DiscussionMessage_Post and now it seems to be working fine.
 
Top Bottom