I have a form where I want to validate a field against 2 pieces of information:
a. User Name in Joomla Users
b. Type of Registration in CB.
I wrote the SQL Query and checked that it works. Here is the code I have, I put it in a server side navigation action, but I am not sure it is in the right place, The validation does not take place the form is accepted even if the field is wrong.
Would appreciate some help (I am using CF 4.0.RC 1.9 on Joomla 1.5.23). Here is the code:
a. User Name in Joomla Users
b. Type of Registration in CB.
I wrote the SQL Query and checked that it works. Here is the code I have, I put it in a server side navigation action, but I am not sure it is in the right place, The validation does not take place the form is accepted even if the field is wrong.
Would appreciate some help (I am using CF 4.0.RC 1.9 on Joomla 1.5.23). Here is the code:
<?php
$uname = JRequest::getString('username', '', 'post');
$db =& JFactory::getDBO();
$query = 'SELECT u.username, cb.cb_typeofregistration
FROM #_jos_users AS u
LEFT JOIN #_jos_comprofiler AS cb ON u.id = cb.user_id
WHERE cb.cb_typeofregistration = 'chefs' AND `username` = '$uname'';
$db->setQuery( $query );
if (!$db->loadResult()) {
$form->validation_errors['username'] = "Wrong User Name"];
}
?>