Alofoxx
Member
Im trying to make a php callback class::method for verifying 'field value' is the name of a registered user, like what the participants field uses when you start a new conversation.
So far I have
Jake said:
So far I have
Code:
<?php
class Callback_UserField
{
public static function validate($field, &$value, &$error)
{
if (userCheck($value))
{
return true;
}
else
{
$error = 'The player must be registered on our website.';
return false;
}
}
private static function userCheck ($userIn)
{
$db = XenForo_Application::get('db');
$db->query("
SELECT username FROM xf_user
WHERE username = '%s'
mysql_real_escape_string($userIn),
$result = mysql_query($query);
if (!$result)
{
return false
else
{
if ($result == $userIn)
{
return true;
}
else
{
return false;
}
}
}
}
}
Jake said:
So i posted it here. Any help would be very appreciated. Advice too but i'm not much of a programmer.You have some syntax problems, but that's the right idea.
You really need a programmer to write this for you.