XF 2.2 Call to undefined function

Ozzy47

Well-known member
I'm trying to extend XF\Service\User with something like the following.

Code:
<?php

namespace OzzModz\LoginLogX\XF\Service\User;

use XF\Entity\User;

use function strlen;

class Login extends XFCP_Login
{
    public function validate($password, &$error = null)
    {
        // Set Parent
          $parent = validate($password, $error);
            
          // Let's Get The User's IP
        if (!empty($_SERVER['HTTP_CLIENT_IP']))
        {
            $ip = $_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
        {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
            $ip = $_SERVER['REMOTE_ADDR'];
        }

        // Let's Get The User's UserAgent
        $user_agent = @$_SERVER['HTTP_USER_AGENT'];

        // Limit Legenth Of UserAgent
        $user_agent = substr($user_agent, 0, 254);

        // Make It Safe
        $user_agent = addslashes($user_agent);
          
        // Get User ID
        $user = $this->getUser();
        $userId = $user->user_id;
      
        // Get Username
        $username = $user->username;

        $auth = $user->Auth;
        if (!$auth || !$auth->authenticate($password))   
        {
            // Update Our Table
            $login = $this->em()->create('OzzModz\LoginLogX:LoginLogX');
                $login->username = $username;
                $login->user_id = $userId;
                $login->ipaddress = $ip;
                $login->user_agent = $user_agent;
                $login->dateline = time();
                $login->save();
        }
        // Return To Parent
        return $parent;
    }
}

But on a failed login attempt, I get this error, Call to undefined function OzzModz\LoginLogX\XF\Service\User\validate() src/addons/OzzModz/LoginLogX/XF/Service/User/Login.php:14 not sure what the problem is setting the parent.
 
Back
Top Bottom