public static function match_username_to_user($username, $issuer) {
        $params = [
            'issuerid' => $issuer->get('id'),
            'username' => $username
        ];
        $result = linked_login::get_record($params);

        if ($result) {
            $user = \core_user::get_user($result->get('userid'));
            if (!empty($user) && !$user->deleted) {
                return $result;
            }
        }
        return false;
    }
public static function match_username_to_user($username, $issuer) {
        $params = [
            'issuerid' => $issuer->get('id'),
            'username' => $username
        ];
        $result = linked_login::get_record($params);

        if ($result) {
            $user = \core_user::get_user($result->get('userid'));
            if (!empty($user) && !$user->deleted) {
                return $result;
            }
        }
        return false;
    }
public static function match_username_to_user ( $ username , $ issuer ) { $ params = [ 'issuerid' => $ issuer -> get ( 'id' ) , 'username' => $ username ] ; $ result = linked_login :: get_record ( $ params ) ; if ( $ result ) { $ user = \ core_user :: get_user ( $ result -> get ( 'userid' ) ) ; if ( ! empty ( $ user ) && ! $ user -> deleted ) { return $ result ; } } return false ; }
See if there is a match for this username and issuer in the linked_login table.

@param string $username as returned from an oauth client.
@param \core\oauth2\issuer $issuer
@return stdClass User record if found.
See if there is a match for this username and issuer in the linked_login table .