Is it possible to get the user's information in the PHP callback check for a custom userfield.
Here is what I have:
I need it to make sure nobody else is using the same value for that field, I was going to use the info for the currently logged in user, but that doesn't work if you're editing the user in the AdminCP.
If anybody has any ideas, that would be fantastic.
Here is what I have:
Code:
<?php
class MineVille_MCLogin
{
public static function validate($field, &$value, &$error)
{
$visitor = XenForo_Visitor::getInstance();
$db = XenForo_Application::get('db');
if(!preg_match("/^[a-zA-Z0-9_-]+$/", $value)) {
$error = "This is an invalid MineCraft username.";
return false;
}
if(file_get_contents("https://minecraft.net/haspaid.jsp?user=".$value) == "false") {
$error = "This is an invalid MineCraft username.";
return false;
}
return true;
}
}
I need it to make sure nobody else is using the same value for that field, I was going to use the info for the currently logged in user, but that doesn't work if you're editing the user in the AdminCP.
If anybody has any ideas, that would be fantastic.