XF 2.3 Pulling IP address from user?

Chris Grigg

Active member
Version 2.3.7 XF

Im trying to get my addon (FraudClient) to check for and submit the IP address of a user when checking and reporting to my database.

Code:
public function checkUser(\XF\Entity\User $user)
    {
        $app = \XF::app();
        $client = $app->http()->client();
        $params = [
            'headers' => [
                'accept' => 'application/json',
                'content-type' => 'application/json',
            ],
            'json' => [
                'clientEmail' => $user->email,
                'clientUsername' => $user->username,
                'apiKey' => \XF::options()->ms_fc_api_key,
            ]
        ];

I tried:
Code:
'clientIP' => $user->last_known_ip,
but I don't think this is a correct parameter. Currently, my addon will check against the database the username and email. I'd also like to run the IP address against the database check.
 
Back
Top Bottom