these question introduced me to make use of this script:


Due to my total insufficient understanding I do not understand how do i fit the "Inline AJAX validation" using the "ajax[ajaxUser]" class to operate checking username availability when establishing a brand new account inside a Wordpress site.

Any help could be greatly appreciated. Thanks!

Finally been capable of making it work.

Step One - First got the HTML form. Within the input area in which the username reached be typed you have to include the validation rules you need to affect it, during my situation this:

<input type="text" name="user_login" id="user_login" class="validate[required,length[5,15],ajax[ajaxUser]]" value="Username"/>

"needed" because is really a needed area, "length[5,15]" helps narrow the search and "ajax[ajaxUser]" that is our custom defined regex rule.

Step Two - To gain access to the database used this dbConnector.php:


class DbConnector {

var $theQuery;
var $link;

function DbConnector(){

        // Get the main settings from the array we just loaded
        $host = 'HOST';
        $db = 'DATABASE';
        $user = 'root';
        $pass = 'root';

        // Connect to the database
        $this->link = mysql_connect($host, $user, $pass);
        register_shutdown_function(array(&$this, 'close'));


  //*** Function: query, Purpose: Execute a database query ***
    function query($query) {

        $this->theQuery = $query;
        return mysql_query($query, $this->link);


    //*** Function: fetchArray, Purpose: Get array of query results ***
    function fetchArray($result) {

        return mysql_fetch_array($result);


    //*** Function: close, Purpose: Close the connection ***
    function close() {





Simply need to replace the values $host, $db, $user and $pass using the ones corresponding your server and database.

Step Three - Then produce a file known as validateUser.php that will go ahead and take values in the database, do a comparison using the information typed in the input area and inform the validation js with caused by the compare.



    /* RETURN VALUE */
    $arrayToJs = array();
    $arrayToJs[0] = $validateId;
    $arrayToJs[1] = $validateError;

$connector = new DbConnector();

$query = "SELECT user_login FROM wp_users WHERE user_login = '$validateValue' LIMIT 1";
$result = $connector->query($query);
$num = mysql_num_rows($result);

if($num == 0){      // validate??
    $arrayToJs[2] = "true";         // RETURN TRUE
    echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';          // RETURN ARRAY WITH success
        if($x == 990000){
            $arrayToJs[2] = "false";
            echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}';      // RETURN ARRAY WITH ERROR



Step Four - Totally didn't remember relating to this essential step. You have to spread out the file jquery.validationEngine-en.js and specify you custom regex rule. Look for this comment: "// Add your regex rules here, you are able to take telephone for exampleInch and add your brand-new rule below it:

    "alertTextOk":"* Great! This username is available",    
    "alertTextLoad":"* Loading, please wait",
    "alertText":"* Sorry, this username already been taken"},

There you have it!