XenForo IP Logging

Jake B.

Well-known member
I'm needing to log ip addresses for certain actions performed in an Add-On I am making, but I cannot seem to figure out how they are logged in XenForo. I know that they are contained in xf_ip, and there is a XenForo_Model_Ip class that seems to interface with that table, but I cannot find anything in XenForo referencing that class other than the XenForo_Model_Import class. I've gone through the model/datawriter/controller for posts/threads but can not find where the IP address logging actually takes place to figure out how to work with it, so I was wondering if someone could potentially enlighten me on the process, as I am at a complete roadblock at this point.
 
but I cannot find anything in XenForo referencing that class
o_O Are you sure?

Check XenForo_DataWriter_DiscussionMessage::_updateIpData

Specifically:
PHP:
$ipId = XenForo_Model_Ip::log(
    $this->get('user_id'), $this->getContentType(), $this->getDiscussionMessageId(), 'insert', $ipAddress
);
$this->set('ip_id', $ipId, '', array('setAfterPreSave' => true));
 
o_O Are you sure?

Check XenForo_DataWriter_DiscussionMessage::_updateIpData

Specifically:
PHP:
$ipId = XenForo_Model_Ip::log(
    $this->get('user_id'), $this->getContentType(), $this->getDiscussionMessageId(), 'insert', $ipAddress
);
$this->set('ip_id', $ipId, '', array('setAfterPreSave' => true));

Well, I didn't even think to look in XenForo_DataWriter_DiscussionMessage, I just looked in XenForo_DataWriter_DiscussionMessage_Post and XenForo_DataWriter_Discussion_Thread. Can't believe I missed that, thanks!

And that's odd, I did a file search in eclipse for XenForo_Model_Ip and only thing that showed up was library/XenForo/Model/Ip.php and library/XenForo/Model/Import.php. There must be something up with my Eclipse, thanks for getting me in the right direction though!
 
Top Bottom