Bring in members and events to the search page.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 2 Feb 2018 19:58:38 +0000 (14:58 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 2 Feb 2018 19:58:38 +0000 (14:58 -0500)
Adding member and events.

glm-member-db/views/front/members/list.html
inc/custom.php
template-parts/search-overlay.php

index 8a63671..cbfa84f 100644 (file)
@@ -17,6 +17,9 @@
         <div id="glm-member-list-filters-box">
             <div id="glm-member-list-filters-close" class="button glm-button glm-member-list-filters-toggle">Close</div>
             <form action="{$thisUrl}?glm_action=list" method="post" enctype="multipart/form-data">
+                {if $smarty.request.s}
+                <input type="hidden" name="s" value="{$smarty.request.s|escape}">
+                {/if}
                 <div class="small-12 columns glm-member-search glm-member-entry-container glm-member-container">
                     {apply_filters('glm-member-db-front-members-list-searchFormTop', '')}
                     <div>
                         </select>
                     </div>
                     {/if}
-              
+
 
                     {if $settings.list_show_search_text}
                         <div>
 <div class="glm-member-list-listing-container">
 {if $settings.list_show_search_alpha}
     <div class="glm-alpha-links">
-        <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}" class="glm-alpha-link{if !$alphaSelected} glm-alpha-link-selected{/if}">All</a>
+        <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}" class="glm-alpha-link{if !$alphaSelected} glm-alpha-link-selected{/if}">All</a>
   {foreach $alphaList as $a}
-        <a href="{$thisUrl}?glm_action=list&alpha={$a.alpha}&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}" class="glm-alpha-link{if $a.default} glm-alpha-link-selected{/if}">{$a.alpha}</a>
+        <a href="{$thisUrl}?glm_action=list&alpha={$a.alpha}&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}" class="glm-alpha-link{if $a.default} glm-alpha-link-selected{/if}">{$a.alpha}</a>
   {/foreach}
    </div>
 {/if}
 
 {if $paging}
     <br>
-    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
-    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
+    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
+    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
     <br>
     showing {$start} through {$lastDisplayed} of {$filteredMembersFound}
 {/if}
                             </div>
                         {/if}
 
-                        
+
                     </div>
                 </div> <!-- End of glm-member-db-border-wrap -->
             </a>
 
 {if $paging}
     <br>
-    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
-    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
+    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Previous&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$prevStart} style="pointer-events: none; opacity: 0.5;"{/if}>Previous page</a>
+    <a href="{$thisUrl}?glm_action=list&textSearch={$textSearch}&s={$textSearch}&categorySearch={$catSearchSelected}&regionSearch={$regionSearchSelected}&pageSelect=Next&prevStart={$prevStart}&nextStart={$nextStart}&limit={$limit}&alpha={$alphaSelected}" class="glm-alpha-link" {if !$nextStart} style="pointer-events: none; opacity: 0.5;"{/if}>Next page</a>
     <br>
     showing {$start} through {$lastDisplayed} of {$filteredMembersFound}
 {/if}
     </div><!-- glm-member-list-inner-wrapper-->
 </div><!-- glm-member-db-list-view -->
 {include file='front/footer.html'}
-<!-- if not generic view passed in member list shortcode-->
\ No newline at end of file
+<!-- if not generic view passed in member list shortcode-->
index 9b6e086..d034c46 100644 (file)
@@ -126,6 +126,9 @@ add_filter('pre_get_posts', 'change_wp_search_size'); // Hook our custom functio
 
 function display_memberfindme_directory() {
        // Show MemberFindMe shortcode from Directory page
+    $_REQUEST['textSearch'] = $_REQUEST['s'];
+    $_REQUEST['action'] = 'list';
+    $_REQUEST['event_name'] = $_REQUEST['s'];
        $my_postid = 30722;//This is page id or post id
        $content_post = get_post($my_postid);
        $content = $content_post->post_content;
@@ -591,7 +594,14 @@ function remove_events_metaboxes() {
     remove_meta_box( 'wpseo_meta' , 'event' , 'normal' );
 }
 add_action( 'admin_menu' , 'remove_events_metaboxes' );
-
+add_filter('glm-member-db-fields-front-list-query-params', function( $query ){
+    $queryParams = array();
+    if ( isset( $_REQUEST['textSearch'] )  ) {
+        $textSearch = filter_var($_REQUEST['textSearch']);
+        $queryParams[] = "textSearch={$textSearch}";
+    }
+    return ( !empty( $queryParams ) ? $query . '&'.implode( '&', $queryParams): $query);
+},10, 1);
 
 // Filter to change the order of taxonomy terms in GF request form
 function custom_lead_member_cat_order($args) {
index b22b89c..2193853 100644 (file)
 
         var myEl = document.getElementById('overlay_search');
 
-        myEl.addEventListener('click', function() {window.location = '<?php esc_url( home_url());echo '/?s='; ?>' + encodeURI(document.getElementById('tag').value) + '#!directory/map/ord=rnd/tag=' + encodeURI(document.getElementById('tag').value) + '/lbl=' + encodeURI(document.getElementById('lbl').value)  + '/xlo=' + encodeURI(document.getElementById('xlo').value) + '/xre=' + encodeURI(document.getElementById('xre').value) ;
+        myEl.addEventListener('click', function() {window.location = '<?php esc_url( home_url());echo '/?s='; ?>' + encodeURI(document.getElementById('tag').value) + '&textSearch='+ encodeURI(document.getElementById('tag').value) +'&glm_action=list';
+        //'#!directory/map/ord=rnd/tag=' + encodeURI(document.getElementById('tag').value) + '/lbl=' + encodeURI(document.getElementById('lbl').value)  + '/xlo=' + encodeURI(document.getElementById('xlo').value) + '/xre=' + encodeURI(document.getElementById('xre').value) ;
 
 
         }, false);
     </script>
 
 
-</div>
\ No newline at end of file
+</div>