From 1abfd5ffbd7566aaeda48d500b9d6d844ba81216 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 18 Jul 2016 13:33:11 -0400 Subject: [PATCH] Update for interest names with specialchars Do htmlspecialchars_decode to check for matches. --- setup/frontHooks.php | 25 +++++++++++++++++++------ views/admin/leads/index.html | 6 ++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 5a673dc..11f24bc 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -15,7 +15,7 @@ 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. * @@ -28,7 +28,12 @@ require_once GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataInterestGroups.php'; * *** 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; /* @@ -94,6 +99,12 @@ add_filter( 'gform_pre_render', function( $form ) { // 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. @@ -207,7 +218,7 @@ add_action( 'gform_after_submission', function( $entry, $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 @@ -264,14 +275,16 @@ add_action( 'gform_after_submission', function( $entry, $form ){ 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 diff --git a/views/admin/leads/index.html b/views/admin/leads/index.html index fe4eafc..e4b6791 100644 --- a/views/admin/leads/index.html +++ b/views/admin/leads/index.html @@ -19,7 +19,7 @@ - +
@@ -93,7 +93,7 @@
-{if $leads} +{if $haveLeads}

Search Results:

Download as CSV File @@ -136,6 +136,8 @@ {/if} +{else if $searching} +Sorry, Nothing matches your search. {/if} -- 2.17.1