Validate pre-listed email to allow registration

kdiamond

Member
Hey all -

Quick background:
1. applicants fill out an fabrik application form from our home page.
2. we take them through the interview process
3. If approved they have a field on the application set to 'Vendor Approved'

I now want that person to register as a user on our site.
1. register using a new profiles form (fabrik)
2. using juser to create joomla user - BUT I only want to allow the registration to proceed if they have entered an email that matches the "Vendor Approved" emails from the application. I know the plugin has if false conditions but don't really know how to get these two factors to play nice.
3. If an email is not entered that matches 1. In the list, and 2. Vendor approved , then block the process, or whatever mechanism there may be to stop them.

Reading the wiki- I am able to gather this much for the condition. I am more proficient in sql, so this syntax escapes me.

return '{pet_applications___status}' == '5' and '{THE EMAIL I ENTERED IN THE PROFILE FORM'} exists {APPLICATIONS LIST__EMAIL FIELD};

Thanks in advance.
 
I assume you want to stop the complete form submission.
Not to submit the form - i.e. create a record in your Fabrik registration list but then stop the execution of the jUser plugin (this is what the condition is for).

To stop the form submission add a php validation to the email element, something like (replace table, column and element names)
Code:
$email =$data;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
    ->select('count(*)')
    ->from('`APPLICATIONSLIST`')
    ->where('`EMAIL FIELD` = ' . $db->quote($email));
 
$db->setQuery($query);
$emailexists = $db->loadResult();
 
return  (bool)$emailexists;
http://fabrikar.com/forums/index.php?wiki/common-php-tasks/
 
Re-reading your post:
if you really want to stop only the jUser plugin put the similar code into the condition
Code:
$email ='{email-full-element-name}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
    ->select('count(*)')
    ->from('`APPLICATIONSLIST`')
    ->where('`EMAIL FIELD` = ' . $db->quote($email));
 
$db->setQuery($query);
$emailexists = $db->loadResult();
 
return  '{pet_applications___status}' == '5' and (bool)$emailexists;
 
This is great - thank you. Yes, blocking the form completely is much better - appreciate the guidance.

Only missing piece is that other status variable I mentioned. This seems to have done the trick:

$email =$data;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('count(*)')
->from('`pet_applications`')
->where('`Email` = ' . $db->quote($email))
->and('status = 5');

$db->setQuery($query);
$emailexists = $db->loadResult();

return (bool)$emailexists;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top