Fix the request vars being set unless they are true.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Oct 2017 18:26:01 +0000 (14:26 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Oct 2017 18:26:01 +0000 (14:26 -0400)
When setting request only do so if the request custom field has value.

setup/frontHooks.php

index 0ea8e83..e0124fd 100644 (file)
@@ -99,7 +99,7 @@ add_filter( 'glm-member-db-front-search-request', function( $actionData ) {
         foreach ( $customFields as $key => $field ) {
             // convert name to lower case and replace spaces with _
             $field_name = preg_replace( '/[ -]/', '_', strtolower( $field['field_name'] ) );
-            if ( isset( $actionData['request'][$field_name] ) ) {
+            if ( isset( $actionData['request'][$field_name] ) && $actionData['request'][$field_name]) {
                 $_REQUEST[$field_name] = $actionData['request'][$field_name];
             }
         }