Finally, I was able to put everything together and make this thing work. Thank you both for all your help.
Now. I have one issue/question.
The following line is updating the username:
PHP Code:
vB::getDbAssertor()->update( 'user', array( 'username' => $username ), array( "userid" => $vb_userid ) );
The only issue is that it doesn't check if the username is already in use or not and it allows duplicate usernames. So I need to first check the user table in the database and throw an error if username is duplicate.
Is there any instruction on how to search the vB database to search for data? Can you help?