I am a .NET/Java developer so I'm not very familiar with PHP although I have dabbled with it in the past and am a total noob with Expression Engine. I am working on a project at work along side our front-end site developer who is using EE to build a membership site. We are using FreeForm Pro to create 2 or 3 user forms.
The first is a simple form asking for first name, last name and email address. When the user supplies this information and clicks the submit button we want to be able to verify the person's existence in a table that was not created by the installation of the FreeForm module. At the moment I copied the basic form code example from FreeForm documentation pages and pasted it to a Template in EE:
<h3>Contact Us</h3>
<p>
To send us a message, please fill out the form below.
We’ll get back to you shortly!
</p>
{exp:freeform:form
form_name="contact"
return="contact_us/thank_you"
}
<dl>
{freeform:all_form_fields}
<dt><label>{freeform:field_label}</label></dt>
<dd>{freeform:field_output}</dd>
{/freeform:all_form_fields}
</dl>
{if freeform:captcha}
<p>Please enter the word you see in the image below:</p>
<p>{freeform:captcha}<br />
<input type="text" name="captcha" style="width:140px;" /></p>
{/if}
<p>{freeform:submit}</p>
{if freeform:no_results}
<p>
Specified form was not found. Please make sure you have
specified the correct short name of the form in the
<b>form_name</b> parameter.
</p>
{/if}
{/exp:freeform:form}
When submit button on this form is clicked the data gets saved into the table exp_freeform_form_entries_1. This is unnecessary for us but not a big deal. What we want to do is verify with a table that was not created by the FreeForm module like a membership_staging table to determine if the person is already registered. The membership_staging table is a table that was imported from another application.
We were thinking we could use one of the extension hooks like freeform_module_insert_begin to redirect the forms functionality to do a simple query and comparison to the membership_staging table but are have not been able to figure out how the hooks are triggered and how to use them correctly. I copy/pasted the following hook code from the FreeForm documentation into my EE Template.
if (ee()->extensions->active_hook('freeform_module_insert_begin') === TRUE)
{
$field_input_data = ee()->extensions->universal_call(
'freeform_module_insert_begin',
$field_input_data,
$entry_id,
$form_id,
$this
);
if (ee()->extensions->end_script === TRUE)
{
return;
}
}
I am not sure if this piece of code is being executed when the submit button is clicked and have no idea how to test if it is. I have scoured the internet for the past week looking for tutorials or examples of how to utilize hooks in an EE template but only find tutorials and example on how to build extensions and none of them talk about hooks and how to use them.
I would greatly appreciate it if someone could assist me in filling in the blank.