1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XenForo IP Logging

Discussion in 'XenForo Development Discussions' started by Jake B., Sep 15, 2014.

  1. Jake B.

    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.
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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));
     
    Jake B. likes this.
  3. Jake B.

    Jake B. Well-Known Member

    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!
     
    Chris D likes this.

Share This Page