require_once GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataInterests.php';
require_once GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataInterestGroups.php';
-/*
+/**
* Place Misc Hooks and Filters here. If this file exists, it will be included
* by the add-on main plugin script.
*
* *** Also note that parameters will be in the context of the main front controller constructor. ***
*/
-// Inject things into gravity forms fields - This intercepts all GravityForms before displaying them
+/**
+ * Add Filter: gform_pre_render action
+ *
+ * To setup the form so it can display the groups of interests. This intercepts
+ * all GravityForms before displaying them.
+ */
add_filter( 'gform_pre_render', function( $form ) {
$form_enabled = false;
/*
// Return the form.
return $form;
});
+/**
+ * Add Filter: gform_after_submission action
+ *
+ * This action is done after the form has been validated and after the entry is
+ * made by Gravity Forms.
+ */
add_action( 'gform_after_submission', function( $entry, $form ){
/*
* Get the source id for the form.
array(
'email' => $glm_leads_entry['email'],
'created' => $entry['date_created'],
- 'mail_ok' => ( isset( $glm_leads_entry['mail_ok'] ) && $glm_leads_entry['mail_ok'] ) ? 1: 0,
+ 'mail_ok' => ( isset( $glm_leads_entry['mail_ok'] ) && $glm_leads_entry['mail_ok'] ) ? 1: 0,
'member_ok' => ( isset( $glm_leads_entry['member_ok'] ) && $glm_leads_entry['member_ok'] ) ? 1: 0,
), // data
array( '%s', '%s', '%s', '%s' ) // data format
if ( $lead_entry === false ) {
die( 'lead_entry error given' );
}
- $lead_entry_id = $this->wpdb->insert_id;
+ $lead_entry_id = $this->wpdb->insert_id;
- $ints = array();
+ // grab the interest
$interestsData = new GlmDataInterests( $this->wpdb, $this->config );
$interests = $interestsData->getList();
+
+ $ints = array();
if ( $interests ) {
foreach ( $interests as $interest ) {
- $ints[$interest['id']] = $interest['title'];
+ $ints[$interest['id']] = htmlspecialchars_decode( $interest['title'] );
}
}
// create the lead to interest entries
<input type="hidden" name="prevStart" value="{$prevStart}" />
<input type="hidden" name="nextStart" value="{$nextStart}" />
<input type="hidden" name="limit" value="{$limit}" />
- <table style="width: 500px;" id="lead-search-form"{if $searching && $haveLeads} class="hide"{/if}>
+ <table style="width: 500px;" id="lead-search-form"{if $searching} class="hide"{/if}>
<tr>
<td style="text-align: right;"><label for="glm-form-source_id">Source</label></td>
<td>
</tr>
</table>
-{if $leads}
+{if $haveLeads}
<h4>Search Results:</h4>
<a href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=csvExport" class="button">Download as CSV File</a>
<input type="Submit" name="pageSelect" value="Previous {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
<input type="Submit" name="pageSelect" value="Next {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
{/if}
+{else if $searching}
+<strong>Sorry, Nothing matches your search.</strong>
{/if}
</form>