Improving the member search.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 9 Nov 2017 15:29:57 +0000 (10:29 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 9 Nov 2017 15:29:57 +0000 (10:29 -0500)
Remember last search and add a link to 'Back to Search'.
Saving the search now in php session.
Will reset when the list page is hit again.
Resets for each search.
Now showing the name search back into the field. Fixed issue with quotes
and apostrophes.

css/admin.css
index.php
models/admin/members/list.php
readme.txt
views/admin/member/header.html
views/admin/member/memberInfo.html
views/admin/members/list.html

index 21ba622..cf06d9e 100644 (file)
@@ -639,14 +639,16 @@ td.glm-nowrap {
     color: white;
 }
 
-#glm-admin-content-container .button-primary {
+#glm-admin-content-container .button-primary,
+.glm-associate-admin-wrap .button-primary {
     background-color: #0568B3;
     color: white;
     text-shadow: none;
     border: 1px solid darkblue;
     box-shadow: 0px 1px 0px darkblue;
 }
-#glm-admin-content-container .button-primary:hover {
+#glm-admin-content-container .button-primary:hover,
+.glm-associate-admin-wrap .button-primary:hover {
     background-color: #3D84D0;
     box-shadow: 0px -1px 0px darkblue;
 }
index b60e61e..4aa662e 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 2.10.17
+ * Version: 2.10.18
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabase
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 2.10.17
+ * @version 2.10.18
  */
 
 // Check that we're being called by WordPress.
@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
  *
  */
 
-define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.17');
+define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.18');
 define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.32');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
index 545231e..f8ffd6f 100644 (file)
@@ -126,6 +126,16 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         $enable_members     = $this->config['settings']['enable_members'];
         $textSearch         = false;
 
+        // Save all query parameters
+        if ( isset( $_REQUEST['glm_action'] ) && $_REQUEST['glm_action'] == 'list' ) {
+            $_SESSION['member_saved_search'] = $_REQUEST;
+        } else if ( !isset( $_REQUEST['glm_action'] ) && !filter_var( $_REQUEST['back_to_search'], FILTER_VALIDATE_BOOLEAN ) ) {
+            unset( $_SESSION['member_saved_search'] );
+        }
+        // Check for back to search flag
+        if ( isset( $_REQUEST['back_to_search'] ) && filter_var( $_REQUEST['back_to_search'], FILTER_VALIDATE_BOOLEAN ) ) {
+            $_REQUEST = $_SESSION['member_saved_search'];
+        }
         // Check if this is a request to show archived members
         if (isset($_REQUEST['filterArchived'])) {
             $where .= " AND access = ".$this->config['access_numb']['Archived'];
@@ -140,7 +150,8 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         // Check for a text search
         if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search']) != '') {
 
-            $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
+            // $textSearch = addslashes(filter_input(INPUT_POST, 'text_search', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
+            $textSearch = addslashes(filter_var($_REQUEST['text_search'], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
             $where .= " AND T.id in (
                 SELECT DISTINCT(member)
                   FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
@@ -348,6 +359,11 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         // Create current month/date string to pre-populate the Month/Year field for
         $monthYear = date('F Y');
 
+        // Update the textSearch for output into the form.
+        $textSearch = str_replace("\'", "'", $textSearch );
+        $textSearch = str_replace('\\"', '&quot;', $textSearch );
+        $textSearch = str_replace('\\', '', $textSearch );
+
         // Compile template data
         $templateData = array(
             'monthYear'      => $monthYear,
index 8262c5c..aadf949 100644 (file)
@@ -66,9 +66,13 @@ There is of course much more to this.
 (none)
 
 == Changelog ==
+= 2.10.18 =
+* Improve member search in admin. Can now use Back To Search button to return
+  to your last search. Resets when list page is called.
+* Member name search improved.
 
 = 2.10.16 =
-* Fixed version number in index.php that wasn't updated with last hotfix. 
+* Fixed version number in index.php that wasn't updated with last hotfix.
 
 = 2.10.15 =
 * When a new member is added the user is now redirected to the member dashboard
index 8718c12..b4407ff 100644 (file)
@@ -7,7 +7,7 @@
 {/if}
 
 <div class="wrap glm-associate-admin-wrap glm-associate-admin-member-wrap">
-       
+
     <h2>
         {if $haveMember}
             {$terms.term_member_cap}: <span class="glm-notice">{$memberName}</span>
             New {$terms.term_member_cap}
         {/if}
     </h2>
+    <a class="button button-primary glm-right" href="{$thisUrl}?page=glm-members-admin-menu-members-list&back_to_search=1">Back To Search</a>
 
     <h2 class="nav-tab-wrapper">
         <a href="{$thisUrl}?page={$thisPage}" class="nav-tab{if $thisAction==index || $thisAction==memberEdit || $thisAction==memberInfo} nav-tab-active{/if}">{$terms.term_member_cap} Dashboard</a>
 {if $memberID}
   {foreach $addOnTabs as $a}
         <a href="{$thisUrl}?page={$thisPage}&glm_action={$a.action}{if isset($a.option)}&option={$a.option}{/if}&member={$memberID}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
-  {/foreach}        
+  {/foreach}
 {/if}
 
     </h2>
     <div id="glm-admin-content-container">
-    
-    
\ No newline at end of file
+
+
index 0c1d6ee..40bc62d 100644 (file)
@@ -8,7 +8,6 @@
     <![endif]-->
 
 {if apply_filters('glm_members_permit_admin_member_info_edit', true)}
-
     {if $memberInfoID && $memberInfo}
         <!--  Delete Member Profile dialog -->
         <div id="deleteMemberInfoButton" class="button button-primary glm-right">Delete this {$terms.term_member_cap} Profile Version</div>
index e8b9209..3d70b16 100644 (file)
@@ -9,7 +9,7 @@
 
         <h2 class="glm-admin-table-header">List&nbsp;of&nbsp;{$terms.term_member_plur_cap}</h2>
         <div class="glm-row">
-            <b>Text Search: </b><input  class="glmMembersSearch" type="text" name="text_search" id="autoTest">
+            <b>Text Search: </b><input  class="glmMembersSearch" type="text" name="text_search" id="autoTest" {if $textSearch}value="{$textSearch}"{/if}>
             <input type="submit" value="Submit" style="margin-right: 2em;">
         </div>
 <!--                <th>{$terms.term_member_plur_cap} Found:</th><td><span style="margin-right: 2em;">{$memberCount}</span></td> -->
 
              // Autocomplete for list Text Search
              $( ".glmMembersSearch" ).autocomplete({
-
                  source: availableTags,
                  html: true,
-                 position: { my : "right top", at: "right bottom" },
+                 position: { my : "left top", at: "left bottom" },
                  select: function( event, ui ) {
                      var memberID = ui.item.id;
                      window.location.replace("{$adminUrl}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );