[eluser]Michael Wales[/eluser]
You are in an object oriented development environment - you need to tell PHP what class to find that particular function in. In this case, $this works just fine.
Code:
$data['variables'] = array("username" => $username,
"password" => hash("sha256", $password),
"user_valid" => $this->validate_username($username));
On a side note, you probably want to make that function private by prepending an underscore (function _validate_username). Otherwise it is accessible via the URI.