Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

RSForm!Pro - Unique email address validation rule

Unique email address validation rule

In order to accept only one submission per email address in your forms, a custom validation rule will have to be created and added in /components/com_rsform/helpers/validation.php. The validation function will be similar to the following one:

function unique($param, $extra=null)
{

if(!RSFormProValidations::email($param,null))
return false;
$formId = JRequest::getInt('formId');
$db = JFactory::getDBO();
$param = $db->getEscaped($param);
$db->setQuery("SELECT * FROM #__rsform_submission_values WHERE `FieldName`='Email' AND `FieldValue`='".$param."' AND `FormId`='".$formId."'");
$db->query();
$invalid = $db->getNumRows();
if ($invalid)
return false;
return true;
}

After creating the validation rule and placing it in the validation.php file you will be able to select it, when assigning the validation rule for your email address field in RSForm! Pro.


Note:
You can change the name of the function(in the example above is "unique") in order to assign it a custom name of your choice.

Feedback