Update for adding county into the member city table.
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 7 Nov 2018 20:42:11 +0000 (15:42 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 7 Nov 2018 20:42:11 +0000 (15:42 -0500)
Also more updates for the interactive map.
Adding shortcode attributes for bounds and marker colors.

24 files changed:
assets/MapIcons/InteractiveMap/blue.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/brown.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/green.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/grey.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/orange.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/purple.png [new file with mode: 0644]
assets/MapIcons/InteractiveMap/red.png [new file with mode: 0644]
assets/bg_caption.jpg [new file with mode: 0755]
classes/data/dataCities.php
index.php
js/leaflet-area-map.js
models/admin/ajax/citiesMapData.php
models/admin/ajax/countiesMapData.php [deleted file]
models/admin/ajax/membersMapData.php
models/admin/settings/cities.php
models/front/members/interactivemap.php
setup/databaseScripts/1.1.41-steve [deleted file]
setup/databaseScripts/create_database_V1.1.42.sql [deleted file]
setup/databaseScripts/create_database_V1.1.43.sql [new file with mode: 0755]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V1.1.43.sql [new file with mode: 0755]
setup/shortcodes.php
views/admin/settings/cities.html
views/front/members/interactivemap.html

diff --git a/assets/MapIcons/InteractiveMap/blue.png b/assets/MapIcons/InteractiveMap/blue.png
new file mode 100644 (file)
index 0000000..ad0802b
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/blue.png differ
diff --git a/assets/MapIcons/InteractiveMap/brown.png b/assets/MapIcons/InteractiveMap/brown.png
new file mode 100644 (file)
index 0000000..7d419a5
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/brown.png differ
diff --git a/assets/MapIcons/InteractiveMap/green.png b/assets/MapIcons/InteractiveMap/green.png
new file mode 100644 (file)
index 0000000..5aab919
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/green.png differ
diff --git a/assets/MapIcons/InteractiveMap/grey.png b/assets/MapIcons/InteractiveMap/grey.png
new file mode 100644 (file)
index 0000000..47e7520
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/grey.png differ
diff --git a/assets/MapIcons/InteractiveMap/orange.png b/assets/MapIcons/InteractiveMap/orange.png
new file mode 100644 (file)
index 0000000..e9157f2
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/orange.png differ
diff --git a/assets/MapIcons/InteractiveMap/purple.png b/assets/MapIcons/InteractiveMap/purple.png
new file mode 100644 (file)
index 0000000..f03e487
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/purple.png differ
diff --git a/assets/MapIcons/InteractiveMap/red.png b/assets/MapIcons/InteractiveMap/red.png
new file mode 100644 (file)
index 0000000..8822a1c
Binary files /dev/null and b/assets/MapIcons/InteractiveMap/red.png differ
diff --git a/assets/bg_caption.jpg b/assets/bg_caption.jpg
new file mode 100755 (executable)
index 0000000..742f5df
Binary files /dev/null and b/assets/bg_caption.jpg differ
index 846b289..57681df 100644 (file)
@@ -109,20 +109,34 @@ class GlmDataCities extends GlmDataAbstract
         $this->fields = array(
 
             'id' => array(
-                'field' => 'id',
-                'type' => 'integer',
+                'field'     => 'id',
+                'type'      => 'integer',
                 'view_only' => true,
-                'use' => 'a'
+                'use'       => 'a'
             ),
 
             // Name
             'name' => array(
-                'field' => 'name',
-                'type' => 'text',
+                'field'    => 'name',
+                'type'     => 'text',
                 'required' => true,
-                'unique' => true,
-                'use' => 'a'
-            )
+                'unique'   => true,
+                'use'      => 'a'
+            ),
+
+            // County
+            'county' => array(
+                'field'      => 'county',
+                'type'       => 'pointer',
+                'p_table'    => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'counties',
+                'p_field'    => 'id',
+                'p_orderby'  => 'name',
+                'p_blank'    => true,
+                'force_list' => false,
+                'required'   => false,
+                'use'        => 'a',
+            ),
+
 
         );
 
@@ -213,4 +227,4 @@ class GlmDataCities extends GlmDataAbstract
     }
 }
 
-?>
\ No newline at end of file
+?>
index a13eb27..3a15559 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -48,7 +48,7 @@ if (!defined('ABSPATH')) {
  */
 
 define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.45');
-define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.42');
+define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.43');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
 if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) {
index 94d12d9..2b8a430 100644 (file)
@@ -65,7 +65,6 @@ var GlmMap = {
                 cache: false,
                 dataType: 'json',
                 success: function( mapData ){
-                    console.log( 'mapData: ', mapData );
                     GlmMap._centerCity( mapData )
                 }
             });
@@ -76,11 +75,10 @@ var GlmMap = {
             GlmMap._hideLocations();
             var params = "county_id=" + jQuery(this).data('id');
             jQuery.ajax({
-                url: glm_ajax_url + '?action=glm_members_admin_ajax&glm_action=countiesMapData&' + params,
+                url: glm_ajax_url + '?action=glm_members_admin_ajax&glm_action=citiesMapData&' + params,
                 cache: false,
                 dataType: 'json',
                 success: function( mapData ){
-                    console.log( 'mapData: ', mapData );
                     GlmMap._centerCounty( mapData )
                 }
             });
@@ -146,7 +144,6 @@ var GlmMap = {
     _loadData: function(markers)
     {
         var colorMarker = '';
-        // var markers = data.documentElement.getElementsByTagName("marker");
         for (i = 0; i < markers.length; i++) {
             var name = markers[i].member_name;
             var street = markers[i].addr1;
@@ -169,8 +166,25 @@ var GlmMap = {
             var plannerText = '';//markers[i].getAttribute('plannerText');
             var moreInfoUrl = '';//markers[i].getAttribute('moreInfoUrl');
             var markerColor = markers[i].color;//getAttribute('iconUrl');
+            var category = markers[i].category;
+
+            // Check if there's bounds
+            if ( glm_lat_bounds ) {
+                var latbounds = glm_lat_bounds.split(',');
+                if ( parseFloat(lat) < parseFloat(latbounds[0]) || parseFloat(lat) > parseFloat(latbounds[1]) ) {
+                    // out of bounds
+                    continue;
+                }
+            }
+            if ( glm_lon_bounds ) {
+                var lonbounds = glm_lon_bounds.split(',');
+                if ( parseFloat(lng) < parseFloat(lonbounds[0]) || parseFloat(lng) > parseFloat(lonbounds[1]) ) {
+                    // out of bounds
+                    continue;
+                }
+            }
 
-            var html = '<table><tbody><tr>';
+            var html = '<table style="width: 400px; text-align: left; border: none; padding: 2px;"><tbody><tr>';
             if (street == null) {
                 street = '';
             }
@@ -183,7 +197,7 @@ var GlmMap = {
             if (zip == null) {
                 zip = '';
             }
-            html += '<td><b>' + name + '</b><br>' +
+            html += '<td style="border: none;"><b>' + name + '</b><br>' +
                         street + '<br>' + city + ', ' + state + ' ' + zip;
 
             if (phone != '' && phone != null) {
@@ -209,20 +223,23 @@ var GlmMap = {
 
             html += '<span class="infoWindow directions"><a target="_blank" href="https://maps.google.com/maps/search/?api=1&query='+directions+'">Get Directions</a></span>';
 
-            defaultMarker = L.AwesomeMarkers.icon({
-                prefix: 'fa',
-                icon: 'dot-circle',
-                markerColor: 'blue',
-            });
+            if ( category ) {
 
-            if ( markerColor ) {
-                colorMarker = L.AwesomeMarkers.icon({
-                    prefix: 'fa',
-                    icon: 'dot-circle',
-                    markerColor: markerColor,
+                var LeafIcon = L.Icon.extend({
+                    options: {
+                        shadowUrl: 'res/marker-shadow.png'
+                    }
                 });
-                var leafletMarker = L.marker([lat, lng], { title: name, icon: colorMarker })
-                    .bindPopup( html )
+
+                var iconColor = ( category == 'default' ) ? 'grey': glm_map_colors[category];
+                var iconUrl = glm_assets_url + '/MapIcons/InteractiveMap/' + iconColor + '.png';
+
+                var testIcon = new LeafIcon({
+                    iconUrl: iconUrl,
+                    iconSize: [21, 34],
+                });
+                var leafletMarker = L.marker([lat, lng], { title: name, icon: testIcon })
+                    .bindPopup( html, {width: 400} )
                     .addTo(GlmMap.markerGroup);
             } else {
                 var leafletMarker = L.marker([lat, lng], { title: name, icon: defaultMarker })
@@ -230,6 +247,7 @@ var GlmMap = {
                     .addTo(GlmMap.markerGroup);
             }
 
+
         }
 
         GlmMap.leafletMap.addLayer(GlmMap.markerGroup);
index eef1892..640f133 100644 (file)
@@ -75,6 +75,7 @@ class GlmMembersAdmin_ajax_citiesMapData extends GlmDataCities
     public function modelAction ( $actionData = false )
     {
         $cityData = array();
+        $params   = array();
 
         trigger_error( print_r( $_REQUEST, true ), E_USER_NOTICE );
 
@@ -82,20 +83,25 @@ class GlmMembersAdmin_ajax_citiesMapData extends GlmDataCities
             trigger_error( print_r( $_REQUEST['values'], true ), E_USER_NOTICE );
         }
 
-        $city_id = filter_var( $_REQUEST['city_id'], FILTER_VALIDATE_INT );
+        $city_id   = filter_var( $_REQUEST['city_id'], FILTER_VALIDATE_INT );
+        if ( $city_id ) {
+            $params[] = "id = $city_id";
+        }
+
+        $county_id = filter_var( $_REQUEST['county_id'], FILTER_VALIDATE_INT );
+        if ( $county_id ) {
+            $params[] = "county = $county_id";
+        }
+
+        $where = ' WHERE ' . implode( " AND ", $params );
 
-        $where = "T.id = $city_id";
+        $sql = "SELECT *
+               FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities";
+        $sql .= $where;
 
-        $cityData = $this->wpdb->get_results(
-            $this->wpdb->prepare(
-                "SELECT *
-                   FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities
-                  WHERE id = %d",
-            $city_id
-            ),
-            ARRAY_A
-        );
+        trigger_error( $sql, E_USER_NOTICE );
 
+        $cityData = $this->wpdb->get_results( $sql, ARRAY_A );
 
         header( 'Content-type: application/json' );
         echo json_encode( $cityData );
diff --git a/models/admin/ajax/countiesMapData.php b/models/admin/ajax/countiesMapData.php
deleted file mode 100644 (file)
index 8733351..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Members Database
- * File Library - File Delete
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @version  0.1
- */
-
-// Load Members data abstract
-require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCounties.php';
-
-/*
- * This class performs the work of handling images passed to it via
- * an AJAX call that goes through the WorPress AJAX Handler.
- *
- */
-class GlmMembersAdmin_ajax_countiesMapData extends GlmDataCounties
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-
-    /*
-     * Constructor
-     *
-     * This contructor sets up this model. At this time that only includes
-     * storing away the WordPress data object.
-     *
-     * @return object Class object
-     *
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        // Run constructor for members data class
-        parent::__construct(false, false);
-
-    }
-
-    /*
-     * Perform Model Action
-     *
-     * This modelAction takes an AJAX image upload and stores the image in the
-     * media/images directory of the plugin.
-     *
-     * This model action does not return, it simply does it's work then calls die();
-     *
-     * @param $_REQUEST['id']  File Library ID
-     */
-    public function modelAction ( $actionData = false )
-    {
-        $countyData = array();
-
-        trigger_error( print_r( $_REQUEST, true ), E_USER_NOTICE );
-
-        if ( isset( $_REQUEST['values'] ) ) {
-            trigger_error( print_r( $_REQUEST['values'], true ), E_USER_NOTICE );
-        }
-
-        $county_id = filter_var( $_REQUEST['county_id'], FILTER_VALIDATE_INT );
-
-        $where = "T.id = $county_id";
-
-        $countyData = $this->wpdb->get_results(
-            $this->wpdb->prepare(
-                "SELECT *
-                   FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "counties
-                  WHERE id = %d",
-            $county_id
-            ),
-            ARRAY_A
-        );
-
-
-        header( 'Content-type: application/json' );
-        echo json_encode( $countyData );
-
-        exit;
-
-    }
-
-}
index bbbcf46..38a5eab 100644 (file)
@@ -122,9 +122,11 @@ class GlmMembersAdmin_ajax_membersMapData extends GlmDataMemberInfo
                 ARRAY_A
             );
             if ( count( $cats ) > 1 || count( $cats ) == 0 ) {
-                $memberInfo['color'] = 'blue';
+                $memberInfo['color']    = 'grey';
+                $memberInfo['category'] = 'default';
             } else if ( count( $cats ) == 1 ) {
-                $memberInfo['color'] = $colorArray[$cats[0]['parent']];
+                $memberInfo['color']    = $colorArray[$cats[0]['parent']];
+                $memberInfo['category'] = $cats[0]['parent'];
             }
         }
 
index 2c9378c..2ee87c1 100644 (file)
@@ -15,6 +15,7 @@
 
 // Load Member Types data abstract
 require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCounties.php';
 
 /*
  * This class performs the work for the default action of the "Members" menu
@@ -102,6 +103,7 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities
         $success        = true;
         $haveCities     = false;
         $cities         = false;
+        $counties       = false;
         $error          = false;
 
         // Check if a city ID is supplied
@@ -138,6 +140,9 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities
         // Get a current list of members
         $cities = $this->getList( '', 'name' );
 
+        $Counties = new GlmDataCounties( $this->wpdb, $this->config );
+        $counties = $Counties->getList();
+
         // If we have list entries - even if it's an empty list
         $success = true;
         $haveCities = false;
@@ -183,6 +188,7 @@ class GlmMembersAdmin_settings_cities extends GlmDataCities
         $templateData = array(
             'haveCities'            => $haveCities,
             'cities'                => $cities,
+            'counties'              => $counties,
             'citiesWithMembers'     => $citiesWithMembers,
             'citiesWithMembersJSON' => $citiesWithMembersJSON
 
index 36ff470..e0d61a9 100644 (file)
@@ -99,9 +99,21 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo
      */
     public function modelAction ( $actionData = false )
     {
-        $settings = array();
-        $success  = true;
-        $mainCats = array();
+        $settings   = array();
+        $success    = true;
+        $mainCats   =
+        $mainColors =
+        $colors     = array();
+        $latbounds  =
+        $latbounds  = false;
+
+        if ( $actionData['request']['lon-bounds'] ) {
+            $latbounds = $actionData['request']['lat-bounds'];
+        }
+
+        if ( $actionData['request']['lon-bounds'] ) {
+            $lonbounds = $actionData['request']['lon-bounds'];
+        }
 
         if ( $actionData['request']['main-level-cats'] ) {
             // Setup the main level categories for the Map.
@@ -114,6 +126,18 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo
             }
         }
 
+        if ( $actionData['request']['main-level-colors'] ) {
+            // Setup the main level colors
+            $mainColorsRequested = explode( ',', $actionData['request']['main-level-colors'] );
+
+            foreach ( $mainColorsRequested as $k => $v ) {
+                $mainColors[] =  $v;
+            }
+
+        }
+
+        $colors = array_combine( $mainCats, $mainColors );
+
         // Need Member Categories (with active members)
         // Need Cities (with active members)
         // Need Regions (with active members)
@@ -124,6 +148,9 @@ class GlmMembersFront_members_interactivemap //extends GlmDataMemberInfo
             'counties'   => $this->getCounties(),
             'counties'   => $this->getCounties(),
             'cities'     => $this->getCities(),
+            'latbounds'  => $latbounds,
+            'lonbounds'  => $lonbounds,
+            'colors'     => $colors,
         );
         // echo '<pre>$categories: ' . print_r( $this->getMemberCategories(), true ) . '</pre>';
 
diff --git a/setup/databaseScripts/1.1.41-steve b/setup/databaseScripts/1.1.41-steve
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/setup/databaseScripts/create_database_V1.1.42.sql b/setup/databaseScripts/create_database_V1.1.42.sql
deleted file mode 100755 (executable)
index 847cf02..0000000
+++ /dev/null
@@ -1,697 +0,0 @@
--- Gaslight Media Members Database
--- File Created: 12/29/16 12:06:00
--- Database Version: 1.1.41
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Amenities
-CREATE TABLE {prefix}amenities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active TINYINT(1) NULL,                   -- Amenity is active flag
-  name TINYTEXT NULL,                       -- Name of amenity
-  descr TEXT NULL,                          -- Description of amenity
-  short_descr TINYTEXT NULL,                -- Short description of amenity
-  ref_type INT NULL,                        -- Type of entity these amenities are associated with - see plugin.ini ref_type tables
-  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
--- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
-CREATE TABLE {prefix}amenity_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  amenity INT NULL,                         -- Pointer to amenity in amenities table
-  ref_type INT NULL,                        -- Copy of ref_type from matching amenities table entry - to simplify searches
-  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
-  amenity_value TINYTEXT NULL,              -- Quantity if amenity uses values
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- groups
-CREATE TABLE {prefix}amenity_groups (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NULL,                     -- Name of the Group
-    PRIMARY KEY (id),
-    INDEX(name(20))
-);
-
-----
-
--- Amenity Group - Links a specific amenity to groups
-CREATE TABLE {prefix}grouped_amenities (
-    id INT NOT NULL AUTO_INCREMENT,
-    group_id INT,                              -- Pointer to the group
-    amenity_id INT,                            -- Pointer to the Amenity
-    searchable BOOLEAN DEFAULT '0',         -- Flag indicating whether the amenity group will show in the search form
-    PRIMARY KEY (id)
-);
-
-----
-
--- Member Cateogries - used with member information records
-CREATE TABLE {prefix}categories (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of this category
-  descr TEXT NULL,                          -- Description of this category
-  short_descr TINYTEXT NULL,                -- Short description of this category
-  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
-  PRIMARY KEY (id)
-);
-
-----
-
--- Mapping of categories to specific member information records
-CREATE TABLE {prefix}category_member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  category INT NULL,                        -- Pointer to category in categories table
-  member_info INT NULL,                     -- Pointer to member information record
-  PRIMARY KEY (id),
-  CONSTRAINT {prefix}categories_fk_1
-    FOREIGN KEY (category)
-    REFERENCES {prefix}categories (id)
-    ON DELETE CASCADE,
-  INDEX(category),
-  INDEX(member_info)
-);
-
-----
-
--- Cities
-CREATE TABLE {prefix}cities (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of city
-  lat FLOAT NULL,                           -- Latitude of city's location
-  lon FLOAT NULL,                           -- Longitude of city's location
-  PRIMARY KEY (id)
-);
-
-----
-
--- Member Click Through Stats Data - Totals of URL click-throughs - Preserved for 2 years
-CREATE TABLE {prefix}clickthrough_stats (
-  member INT NOT NULL,                          -- ID of member
-  stat_type INT NOT NULL,                       -- Type of stat 1 = day, 2 = week, 3 = month
-  stat_date DATE NOT NULL,                      -- Date for which these stats are accumulated (date or first date of week or month)
-  clicks INT NULL,                          -- Number of Clicks
-  PRIMARY KEY (member, stat_type, stat_date),
-  INDEX (member),
-  INDEX (stat_type),
-  INDEX (stat_date)
-);
-
-----
-
--- Files - Files are stored under /wp-content/uploads/glm-member-db/files/
-CREATE TABLE {prefix}files (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
-  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
-  file_name TINYTEXT NULL,                  -- Stored file name for the file
-  descr TEXT NULL,                          -- Description
-  caption TINYTEXT NULL,                    -- Caption for the image
-  position INT NULL,                        -- Numeric position for sequence of display
-  ref_type INT NULL,                        -- Type of entity this image is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
-CREATE TABLE {prefix}images (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
-  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
-  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
-  featured BOOLEAN null,                    -- Image is a member of a group of featured images
-  file_name TINYTEXT NULL,                  -- Stored file name for the image
-  descr TEXT NULL,                          -- Description
-  caption TINYTEXT NULL,                    -- Caption for the image
-  position INT NULL,                        -- Numeric position for sequence of display
-  ref_type INT NULL,                        -- Type of entity this image is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
--- Primary member records - One for each member
-CREATE TABLE {prefix}members (
-  id INT NOT NULL AUTO_INCREMENT,
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  member_type INT NULL,                     -- Pointer to member type in member_type table
-  created DATE NULL,                        -- Date member record was created
-  name TINYTEXT NULL,                       -- Member name
-  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
-  notes TEXT NULL,                          -- General notes - Not displayed in front-end
-  old_member_id TINYTEXT NULL,              -- Old member ID if imported from old database
-  featured BOOLEAN DEFAULT '0',             -- Whether the member is featured
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(member_slug(20)),
-  INDEX(created),
-  INDEX(old_member_id(20))
-);
-
-----
-
--- Member Detail Display Stats Data - Totals of times detail page is displayed - Preserved for 2 years
-CREATE TABLE {prefix}member_detail_stats (
-  member INT NOT NULL,                          -- ID of member
-  stat_type INT NOT NULL,                       -- Type of stat 1 = day, 2 = week, 3 = month
-  stat_date DATE NOT NULL,                      -- Date for which these stats are accumulated (date or first date of week or month)
-  clicks INT NULL,                          -- Number of Clicks
-  PRIMARY KEY (member, stat_type, stat_date),
-  INDEX (member),
-  INDEX (stat_type),
-  INDEX (stat_date)
-);
-
-----
-
--- Member information version record - May be multiples per member - Only one with status "Active" for a distinct date range
-CREATE TABLE {prefix}member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,                          -- Pointer to member record in table members
-  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
-  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
-  reference_name TINYTEXT NULL,             -- Reference name for this member information record - Not displayed on front-end
-  has_no_map_data BOOLEAN DEFAULT '0',      -- True if member info record has no map data
-  has_no_profile BOOLEAN DEFAULT '0',       -- True if member has no profile record
-  descr TEXT NULL,                          -- Description
-  short_descr TEXT NULL,                    -- Short description
-  addr1 TINYTEXT NULL,                      -- Main member location address line 1
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to City in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of member's location
-  lon FLOAT NULL,                           -- Longitude of member's location
-  region INT NULL,                          -- Pointer to entry in regions table
-  county INT NULL,                          -- Pointer to entry in regions table
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL with information about this member
-  reservation_url TEXT NULL,                -- Reservation URL
-  email TINYTEXT NULL,                      -- Main E-Mail address for this member
-  logo TINYTEXT NULL,                       -- Member logo
-  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
-  video_url TINYTEXT NULL,                  -- Video URL
-  video_file TINYTEXT NULL,                 -- Video File Name
-  video_title TINYTEXT NULL,                -- Video Title
-  video_descr TEXT NULL,                    -- Video Description
-  video_type INT NULL,                      -- Video Type - See plugin.ini video type table.
-  live_cam_url TINYTEXT NULL,               -- Live Cam URL
-  live_cam_title TINYTEXT NULL,             -- Live Cam Title
-  live_cam_descr TEXT NULL,                 -- Live Cam Description
-  live_cam_type INT NULL,                   -- Live Cam Type - See plugin.ini video type table.
-  mailing_addr1 TINYTEXT NULL,              -- Mailing Address 1
-  mailing_addr2 TINYTEXT NULL,              -- Mailing Address 2
-  mailing_city INT NULL,                    -- Mailing City  (Pointer to City in cities table)
-  mailing_state TINYTEXT NULL,              -- Mailing State (Two character state code - matches states.ini entries)
-  mailing_zip TINYTEXT NULL,                -- Mailing ZIP/Postal code
-  notes TEXT NULL,                          -- General notes - Not displayed in front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last update date/time
-  PRIMARY KEY (id),
-  INDEX(status),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region),
-  INDEX(county),
-  FULLTEXT KEY member_name (member_name)
-);
-
-----
-
--- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
--- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are.
-CREATE TABLE {prefix}member_type (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of member type
-  descr TINYTEXT NULL,                      -- Description of member type
-  PRIMARY KEY (id)
-);
-
-----
-
--- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
-CREATE TABLE {prefix}regions (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of region
-  descr TEXT NULL,                          -- Description of region
-  short_descr TINYTEXT NULL,                -- Short description of region
-  PRIMARY KEY (id)
-);
-
-----
-
--- Counties
-CREATE TABLE {prefix}counties (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of county
-  descr TEXT NULL,                          -- Description of county
-  short_descr TINYTEXT NULL,                -- Short description of county
-  PRIMARY KEY (id)
-);
-
-----
-
--- File Library Cateogries - used with "Files Library" - Created due to PDF failures in WordPress Media Library
-CREATE TABLE {prefix}file_library_categories (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Name of this category
-  descr TEXT NULL,                          -- Description of this category
-  short_descr TINYTEXT NULL,                -- Short description of this category
-  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
-  PRIMARY KEY (id)
-);
-
-----
-
--- Files Library - Files are stored under /wp-content/uploads/glm-member-db/filesLibrary/
-CREATE TABLE {prefix}file_library (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
-  file_name TINYTEXT NULL,                  -- Stored file name for the file
-  descr TEXT NULL,                          -- Description
-  title TINYTEXT NULL,                      -- File title
-  last_access_time DATETIME NULL,           -- Upload time or last access time
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20))
-);
-
-----
-
--- General settings available on Management page in admin - Only 1 entry in this table
--- Items in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_general (
-  id INT NOT NULL AUTO_INCREMENT,
-  admin_debug BOOLEAN DEFAULT '0',
-  admin_debug_verbose BOOLEAN DEFAULT '0',
-  front_debug BOOLEAN DEFAULT '0',
-  front_debug_verbose BOOLEAN DEFAULT '0',
-  enable_members BOOLEAN DEFAULT '1',
-  selected_map_interface SMALLINT DEFAULT '1',
-  leaflet_tile_server TINYTEXT DEFAULT '',
-  leaflet_tile_server_key TINYTEXT DEFAULT '',
-  google_maps_api_key TINYTEXT DEFAULT '',
-  maps_default_lat FLOAT DEFAULT '45.3749',
-  maps_default_lon FLOAT DEFAULT '-84.9592',
-  maps_default_zoom INTEGER DEFAULT '10',
-  time_zone TINYTEXT DEFAULT NULL,
-  canonical_member_page TINYTEXT DEFAULT NULL,
-  phone_infix TINYTEXT DEFAULT NULL,
-  phone_format TINYTEXT DEFAULT NULL,
-  default_state TINYTEXT DEFAULT NULL,
-  enable_counties BOOLEAN DEFAULT '0',
-  enable_multiple_profiles BOOLEAN DEFAULT '0',
-  enable_single_profile BOOLEAN DEFAULT '0',            -- Hide the add profile and clone profile links/buttons
-  enable_member_reports BOOLEAN DEFAULT '1',
-  enable_caching BOOLEAN DEFAULT '1',
-  enable_contact_edit_only BOOLEAN DEFAULT '0',
-  memb_info_location BOOLEAN DEFAULT '1',
-  memb_info_contact BOOLEAN DEFAULT '1',
-  memb_info_categories BOOLEAN DEFAULT '1',
-  memb_info_images BOOLEAN DEFAULT '1',
-  memb_info_files BOOLEAN DEFAULT '1',
-  memb_info_video BOOLEAN DEFAULT '1',
-  memb_info_cam BOOLEAN DEFAULT '1',
-  file_library BOOLEAN DEFAULT '0',
-  list_show_map BOOLEAN DEFAULT '1',
-  list_show_featured BOOLEAN DEFAULT '0',
-  list_show_featured_count SMALLINT DEFAULT '3',
-  list_show_list BOOLEAN DEFAULT '1',
-  list_order_list SMALLINT DEFAULT '10',
-  list_pagination BOOLEAN DEFAULT '1',
-  list_pagination_count SMALLINT DEFAULT '20',
-  list_show_search_filters_opened BOOLEAN DEFAULT '0',
-  list_show_search BOOLEAN DEFAULT '1',
-  list_show_search_text BOOLEAN DEFAULT '1',
-  list_show_search_category BOOLEAN DEFAULT '1',
-  list_show_search_amenities BOOLEAN DEFAULT '1',
-  list_show_search_region BOOLEAN DEFAULT '1',
-  list_show_search_alpha BOOLEAN DEFAULT '1',
-  list_floating_search BOOLEAN DEFAULT '0',
-  list_floating_search_distance_top INTEGER DEFAULT '0',    -- How far from the top the sticky Search/Filters box should hover
-  list_show_detail_link BOOLEAN DEFAULT '1',
-  list_show_logo BOOLEAN DEFAULT '1',
-  list_logo_size TINYTEXT NULL,
-  list_logo_for_mobile BOOLEAN DEFAULT '1',
-  list_show_address BOOLEAN DEFAULT '1',
-  list_show_street BOOLEAN DEFAULT '1',
-  list_show_citystatezip BOOLEAN DEFAULT '1',
-  list_show_country BOOLEAN DEFAULT '1',
-  list_show_region BOOLEAN DEFAULT '1',
-  list_show_descr BOOLEAN DEFAULT '0',
-  list_show_short_descr BOOLEAN DEFAULT '1',
-  list_show_phone BOOLEAN DEFAULT '1',
-  list_show_tollfree BOOLEAN DEFAULT '1',
-  list_show_url BOOLEAN DEFAULT '1',
-  list_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_show_email BOOLEAN DEFAULT '1',
-  list_show_categories BOOLEAN DEFAULT '0',
-  list_show_creditcards BOOLEAN DEFAULT '0',
-  list_show_amenities BOOLEAN DEFAULT '0',
-  list_show_logo_filler BOOLEAN DEFAULT '1',
-  list_show_live_cam BOOLEAN DEFAULT '1',
-  list_map_show_opened BOOLEAN DEFAULT '0',
-  list_map_show_detaillink BOOLEAN DEFAULT '1',
-  list_map_show_logo BOOLEAN DEFAULT '0',
-  list_map_logo_size TINYTEXT NULL,
-  list_map_show_descr BOOLEAN DEFAULT '0',
-  list_map_show_short_descr BOOLEAN DEFAULT '1',
-  list_map_show_address BOOLEAN DEFAULT '1',
-  list_map_show_street BOOLEAN DEFAULT '1',
-  list_map_show_citystatezip BOOLEAN DEFAULT '1',
-  list_map_show_country BOOLEAN DEFAULT '1',
-  list_map_show_region BOOLEAN DEFAULT '1',
-  list_map_show_phone BOOLEAN DEFAULT '1',
-  list_map_show_tollfree BOOLEAN DEFAULT '1',
-  list_map_show_url BOOLEAN DEFAULT '1',
-  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  list_map_show_email BOOLEAN DEFAULT '1',
-  list_map_show_categories BOOLEAN DEFAULT '0',
-  list_map_show_creditcards BOOLEAN DEFAULT '0',
-  list_map_show_amenities BOOLEAN DEFAULT '0',
-  list_show_packages BOOLEAN DEFAULT '0',
-  list_show_packages_link BOOLEAN DEFAULT '0',
-  list_header_text TINYTEXT DEFAULT NULL,
-  detail_auto_expand_sections BOOLEAN DEFAULT '0',
-  detail_show_map BOOLEAN DEFAULT '1',
-  detail_show_directions BOOLEAN DEFAULT '1',
-  detail_show_logo BOOLEAN DEFAULT '1',
-  detail_logo_size TINYTEXT NULL,
-  detail_show_descr BOOLEAN DEFAULT '1',
-  detail_show_short_descr BOOLEAN DEFAULT '0',
-  detail_show_address BOOLEAN DEFAULT '1',
-  detail_show_street BOOLEAN DEFAULT '1',
-  detail_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_show_country BOOLEAN DEFAULT '1',
-  detail_show_region BOOLEAN DEFAULT '1',
-  detail_show_phone BOOLEAN DEFAULT '1',
-  detail_show_tollfree BOOLEAN DEFAULT '1',
-  detail_show_url BOOLEAN DEFAULT '1',
-  detail_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_show_email BOOLEAN DEFAULT '1',
-  detail_show_categories BOOLEAN DEFAULT '0',
-  detail_show_creditcards BOOLEAN DEFAULT '0',
-  detail_show_amenities BOOLEAN DEFAULT '1',
-  detail_show_imagegallery BOOLEAN DEFAULT '1',
-  detail_show_coupons BOOLEAN DEFAULT '0',
-  detail_show_packages BOOLEAN DEFAULT '0',
-  detail_show_events BOOLEAN DEFAULT '0',
-  detail_show_video BOOLEAN DEFAULT '0',
-  detail_show_live_cam BOOLEAN DEFAULT '0',
-  detail_top_offset_autoscroll INTEGER DEFAULT '0', -- Determines the distance from the top when autoscrolling to a section on member detail pages
-  detail_map_show_logo BOOLEAN DEFAULT '0',
-  detail_map_logo_size TINYTEXT NULL,
-  detail_map_show_descr BOOLEAN DEFAULT '0',
-  detail_map_show_short_descr BOOLEAN DEFAULT '1',
-  detail_map_show_address BOOLEAN DEFAULT '1',
-  detail_map_show_street BOOLEAN DEFAULT '1',
-  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
-  detail_map_show_country BOOLEAN DEFAULT '1',
-  detail_map_show_region BOOLEAN DEFAULT '1',
-  detail_map_show_phone BOOLEAN DEFAULT '1',
-  detail_map_show_tollfree BOOLEAN DEFAULT '1',
-  detail_map_show_url BOOLEAN DEFAULT '1',
-  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
-  detail_map_show_email BOOLEAN DEFAULT '1',
-  detail_map_show_categories BOOLEAN DEFAULT '0',
-  detail_map_show_creditcards BOOLEAN DEFAULT '0',
-  detail_map_show_amenities BOOLEAN DEFAULT '0',
-  members_only_support_email TINYTEXT DEFAULT '',
-  members_only_support_phone TINYTEXT DEFAULT '',
-  updates_notification_to TINYTEXT DEFAULT '',      -- To email address for the notification email
-  updates_notification_from TINYTEXT DEFAULT '',    -- From header for the notification email
-  updates_notification TEXT DEFAULT '',             -- Notification message
-  short_desc_char_limit INTEGER DEFAULT '120',      -- How many characters the short description is limited to - also used for importing
-  use_cluster_markers BOOLEAN DEFAULT '0',          -- Flag to say if cluster markers should be use in maps
-  recaptcha_site_key TINYTEXT DEFAULT '',           -- reCAPTCHA site key
-  recaptcha_secret_key TINYTEXT DEFAULT '',         -- reCAPTCHA secret key
-  recaptcha_header_code TEXT DEFAULT '',            -- reCAPTCHA code for page header
-  recaptcha_form_code TEXT DEFAULT '',              -- reCAPTCHA code for captcha form field
-  PRIMARY KEY (id)
-);
-
-----
-
--- Set default entry
-INSERT INTO {prefix}settings_general
-    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size,
-        list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles, enable_member_reports, enable_caching, updates_notification, enable_single_profile )
-   VALUES
-    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20, 0, 0, 1, 1,
-        'A member has updated their record and is now in a pending state.', 0)
-;
-
-----
-
--- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
--- Terms in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_terms (
-  id INT NOT NULL AUTO_INCREMENT,
-  term_admin_menu_members TINYTEXT NULL,
-  term_admin_menu_member_list TINYTEXT NULL,
-  term_admin_menu_member TINYTEXT NULL,
-  term_admin_menu_configure TINYTEXT NULL,
-  term_admin_menu_settings TINYTEXT NULL,
-  term_admin_menu_shortcodes TINYTEXT NULL,
-  term_admin_menu_members_dashboard TINYTEXT NULL,
-  term_admin_menu_members_list TINYTEXT NULL,
-  term_admin_menu_members_reports TINYTEXT NULL,
-  term_admin_menu_member_dashboard TINYTEXT NULL,
-  term_admin_menu_member_info TINYTEXT NULL,
-  term_admin_menu_member_locations TINYTEXT NULL,
-  term_admin_menu_member_facilities TINYTEXT NULL,
-  term_admin_menu_member_attractions TINYTEXT NULL,
-  term_admin_menu_member_contacts TINYTEXT NULL,
-  term_admin_menu_configure_member_types TINYTEXT NULL,
-  term_admin_menu_configure_member_cats TINYTEXT NULL,
-  term_admin_menu_configure_accom_types TINYTEXT NULL,
-  term_admin_menu_configure_amenities TINYTEXT NULL,
-  term_admin_menu_configure_cities TINYTEXT NULL,
-  term_admin_menu_configure_counties TINYTEXT NULL,
-  term_admin_menu_configure_regions TINYTEXT NULL,
-  term_admin_menu_settings_general TINYTEXT NULL,
-  term_admin_menu_settings_terms TINYTEXT NULL,
-  term_admin_menu_settings_development TINYTEXT NULL,
-  term_member TINYTEXT NULL,
-  term_member_cap TINYTEXT NULL,
-  term_member_plur TINYTEXT NULL,
-  term_member_plur_cap TINYTEXT NULL,
-  term_location TINYTEXT NULL,
-  term_location_cap TINYTEXT NULL,
-  term_location_plur TINYTEXT NULL,
-  term_location_plur_cap TINYTEXT NULL,
-  term_county TINYTEXT NULL,
-  term_county_cap TINYTEXT NULL,
-  term_county_plur TINYTEXT NULL,
-  term_county_plur_cap TINYTEXT NULL,
-  term_facility TINYTEXT NULL,
-  term_facility_cap TINYTEXT NULL,
-  term_facility_plur TINYTEXT NULL,
-  term_facility_plur_cap TINYTEXT NULL,
-  term_attraction TINYTEXT NULL,
-  term_attraction_cap TINYTEXT NULL,
-  term_attraction_plur TINYTEXT NULL,
-  term_attraction_plur_cap TINYTEXT NULL,
-  term_contact TINYTEXT NULL,
-  term_contact_cap TINYTEXT NULL,
-  term_contact_plur TINYTEXT NULL,
-  term_contact_plur_cap TINYTEXT NULL,
-  term_webcam_cap TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
--- Default terms entry
-INSERT INTO {prefix}settings_terms
-    (
-    id,
-    term_admin_menu_members,
-    term_admin_menu_member_list,
-    term_admin_menu_member,
-    term_admin_menu_configure,
-    term_admin_menu_settings,
-    term_admin_menu_shortcodes,
-    term_admin_menu_members_dashboard,
-    term_admin_menu_members_list,
-    term_admin_menu_members_reports,
-    term_admin_menu_member_dashboard,
-    term_admin_menu_member_info,
-    term_admin_menu_member_locations,
-    term_admin_menu_member_facilities,
-    term_admin_menu_member_attractions,
-    term_admin_menu_member_contacts,
-    term_admin_menu_configure_member_types,
-    term_admin_menu_configure_member_cats,
-    term_admin_menu_configure_accom_types,
-    term_admin_menu_configure_amenities,
-    term_admin_menu_configure_cities,
-    term_admin_menu_configure_counties,
-    term_admin_menu_configure_regions,
-    term_admin_menu_settings_general,
-    term_admin_menu_settings_terms,
-    term_admin_menu_settings_development,
-    term_member,
-    term_member_cap,
-    term_member_plur,
-    term_member_plur_cap,
-    term_location,
-    term_location_cap,
-    term_location_plur,
-    term_location_plur_cap,
-    term_county,
-    term_county_cap,
-    term_county_plur,
-    term_county_plur_cap,
-    term_facility,
-    term_facility_cap,
-    term_facility_plur,
-    term_facility_plur_cap,
-    term_attraction,
-    term_attraction_cap,
-    term_attraction_plur,
-    term_attraction_plur_cap,
-    term_contact,
-    term_contact_cap,
-    term_contact_plur,
-    term_contact_plur_cap,
-    term_webcam_cap
-    )
-   VALUES
-    (
-    1,
-    'Members',
-    'Member',
-    'Member',
-    'Configure',
-    'Management',
-    'Shortcodes',
-    'Dashboard',
-    'Member List',
-    'Reports',
-    'Member Dashboard',
-    'Member Info',
-    'Locations',
-    'Facilities',
-    'Attractions',
-    'Contacts',
-    'Member Types',
-    'Member Categories',
-    'Accommodation Types',
-    'Amenities',
-    'Cities',
-    'Counties',
-    'Regions',
-    'General Settings',
-    'Terms & Phrases',
-    'Development',
-    'member',
-    'Member',
-    'members',
-    'Members',
-    'location',
-    'Location',
-    'locations',
-    'Locations',
-    'county',
-    'County',
-    'counties',
-    'Counties',
-    'facility',
-    'Facility',
-    'facilities',
-    'Facilities',
-    'attraction',
-    'Attraction',
-    'attractions',
-    'Attractions',
-    'contact',
-    'Contact',
-    'contacts',
-    'Contacts',
-    'Webcam'
-    )
-;
-
-----
-
--- Shortcode Output Cache
-CREATE TABLE {prefix}cache (
-    shortcode TINYTEXT NULL,
-    cache_code TINYTEXT NOT NULL,
-    created DATETIME NULL,
-    html MEDIUMTEXT NULL,
-    PRIMARY KEY (cache_code(20)),
-    INDEX (created)
-);
-
-----
-
--- Theme Settings - Only 1 entry in this table
-CREATE TABLE {prefix}settings_theme (
-    id INT NOT NULL AUTO_INCREMENT,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Default Theme Settings entry
-INSERT INTO {prefix}settings_theme
-    (
-    id
-    )
-   VALUES
-    (
-    1
-    )
-;
-
-----
-
--- Member Email Notifications
-CREATE TABLE {prefix}email_notifications (
-    id INT NOT NULL AUTO_INCREMENT,
-    notification_message TEXT NULL,
-    declined_message TEXT NULL,
-    approved_message TEXT NULL,
-    to_email TINYTEXT NULL,
-    from_email TINYTEXT NULL,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default email notifications
-INSERT INTO {prefix}email_notifications
-    ( id, notification_message, declined_message, approved_message )
-VALUES
-    ( 1, 'A member has requested a profile update.', 'Your profile update has been declined.', 'Your profile has been approved!' );
-
diff --git a/setup/databaseScripts/create_database_V1.1.43.sql b/setup/databaseScripts/create_database_V1.1.43.sql
new file mode 100755 (executable)
index 0000000..ed45387
--- /dev/null
@@ -0,0 +1,698 @@
+-- Gaslight Media Members Database
+-- File Created: 12/29/16 12:06:00
+-- Database Version: 1.1.41
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Amenities
+CREATE TABLE {prefix}amenities (
+  id INT NOT NULL AUTO_INCREMENT,
+  active TINYINT(1) NULL,                   -- Amenity is active flag
+  name TINYTEXT NULL,                       -- Name of amenity
+  descr TEXT NULL,                          -- Description of amenity
+  short_descr TINYTEXT NULL,                -- Short description of amenity
+  ref_type INT NULL,                        -- Type of entity these amenities are associated with - see plugin.ini ref_type tables
+  uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+-- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
+CREATE TABLE {prefix}amenity_ref (
+  id INT NOT NULL AUTO_INCREMENT,
+  amenity INT NULL,                         -- Pointer to amenity in amenities table
+  ref_type INT NULL,                        -- Copy of ref_type from matching amenities table entry - to simplify searches
+  ref_dest INT NULL,                        -- Pointer to the specific entity of type ref_type
+  amenity_value TINYTEXT NULL,              -- Quantity if amenity uses values
+  PRIMARY KEY (id),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- groups
+CREATE TABLE {prefix}amenity_groups (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NULL,                     -- Name of the Group
+    PRIMARY KEY (id),
+    INDEX(name(20))
+);
+
+----
+
+-- Amenity Group - Links a specific amenity to groups
+CREATE TABLE {prefix}grouped_amenities (
+    id INT NOT NULL AUTO_INCREMENT,
+    group_id INT,                              -- Pointer to the group
+    amenity_id INT,                            -- Pointer to the Amenity
+    searchable BOOLEAN DEFAULT '0',         -- Flag indicating whether the amenity group will show in the search form
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Member Cateogries - used with member information records
+CREATE TABLE {prefix}categories (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of this category
+  descr TEXT NULL,                          -- Description of this category
+  short_descr TINYTEXT NULL,                -- Short description of this category
+  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Mapping of categories to specific member information records
+CREATE TABLE {prefix}category_member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  category INT NULL,                        -- Pointer to category in categories table
+  member_info INT NULL,                     -- Pointer to member information record
+  PRIMARY KEY (id),
+  CONSTRAINT {prefix}categories_fk_1
+    FOREIGN KEY (category)
+    REFERENCES {prefix}categories (id)
+    ON DELETE CASCADE,
+  INDEX(category),
+  INDEX(member_info)
+);
+
+----
+
+-- Cities
+CREATE TABLE {prefix}cities (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of city
+  lat FLOAT NULL,                           -- Latitude of city's location
+  lon FLOAT NULL,                           -- Longitude of city's location
+  county INT NULL,                          -- County reference to county table
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Member Click Through Stats Data - Totals of URL click-throughs - Preserved for 2 years
+CREATE TABLE {prefix}clickthrough_stats (
+  member INT NOT NULL,                          -- ID of member
+  stat_type INT NOT NULL,                       -- Type of stat 1 = day, 2 = week, 3 = month
+  stat_date DATE NOT NULL,                      -- Date for which these stats are accumulated (date or first date of week or month)
+  clicks INT NULL,                          -- Number of Clicks
+  PRIMARY KEY (member, stat_type, stat_date),
+  INDEX (member),
+  INDEX (stat_type),
+  INDEX (stat_date)
+);
+
+----
+
+-- Files - Files are stored under /wp-content/uploads/glm-member-db/files/
+CREATE TABLE {prefix}files (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
+  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
+  file_name TINYTEXT NULL,                  -- Stored file name for the file
+  descr TEXT NULL,                          -- Description
+  caption TINYTEXT NULL,                    -- Caption for the image
+  position INT NULL,                        -- Numeric position for sequence of display
+  ref_type INT NULL,                        -- Type of entity this image is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Images - Images are stored under /wp-content/uploads/glm-member-db/images/{size}/
+CREATE TABLE {prefix}images (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the image - might be URL if copied via HTTP
+  status TINYINT(1) NULL,                   -- Display/Use status - See plugin.ini status table
+  selected BOOLEAN NULL,                    -- A single special image in the current gallery for this entity
+  featured BOOLEAN null,                    -- Image is a member of a group of featured images
+  file_name TINYTEXT NULL,                  -- Stored file name for the image
+  descr TEXT NULL,                          -- Description
+  caption TINYTEXT NULL,                    -- Caption for the image
+  position INT NULL,                        -- Numeric position for sequence of display
+  ref_type INT NULL,                        -- Type of entity this image is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this image is associated with
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Primary member records - One for each member
+CREATE TABLE {prefix}members (
+  id INT NOT NULL AUTO_INCREMENT,
+  access INT NULL,                          -- Access type - See access table in plugin.ini
+  member_type INT NULL,                     -- Pointer to member type in member_type table
+  created DATE NULL,                        -- Date member record was created
+  name TINYTEXT NULL,                       -- Member name
+  member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  old_member_id TINYTEXT NULL,              -- Old member ID if imported from old database
+  featured BOOLEAN DEFAULT '0',             -- Whether the member is featured
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(member_slug(20)),
+  INDEX(created),
+  INDEX(old_member_id(20))
+);
+
+----
+
+-- Member Detail Display Stats Data - Totals of times detail page is displayed - Preserved for 2 years
+CREATE TABLE {prefix}member_detail_stats (
+  member INT NOT NULL,                          -- ID of member
+  stat_type INT NOT NULL,                       -- Type of stat 1 = day, 2 = week, 3 = month
+  stat_date DATE NOT NULL,                      -- Date for which these stats are accumulated (date or first date of week or month)
+  clicks INT NULL,                          -- Number of Clicks
+  PRIMARY KEY (member, stat_type, stat_date),
+  INDEX (member),
+  INDEX (stat_type),
+  INDEX (stat_date)
+);
+
+----
+
+-- Member information version record - May be multiples per member - Only one with status "Active" for a distinct date range
+CREATE TABLE {prefix}member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  member INT NULL,                          -- Pointer to member record in table members
+  member_name TINYTEXT NULL,                -- Copy of member name from members table entry for fast reference
+  status INT NULL,                          -- Status of this member information record - See plugin.ini status table
+  reference_name TINYTEXT NULL,             -- Reference name for this member information record - Not displayed on front-end
+  has_no_map_data BOOLEAN DEFAULT '0',      -- True if member info record has no map data
+  has_no_profile BOOLEAN DEFAULT '0',       -- True if member has no profile record
+  descr TEXT NULL,                          -- Description
+  short_descr TEXT NULL,                    -- Short description
+  addr1 TINYTEXT NULL,                      -- Main member location address line 1
+  addr2 TINYTEXT NULL,                      -- Address line 2
+  city INT NULL,                            -- Pointer to City in cities table
+  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+  zip TINYTEXT NULL,                        -- ZIP/Postal code
+  lat FLOAT NULL,                           -- Latitude of member's location
+  lon FLOAT NULL,                           -- Longitude of member's location
+  region INT NULL,                          -- Pointer to entry in regions table
+  county INT NULL,                          -- Pointer to entry in regions table
+  phone TINYTEXT NULL,                      -- Primary phone number
+  toll_free TINYTEXT NULL,                  -- Toll Free phone number
+  url TINYTEXT NULL,                        -- URL with information about this member
+  reservation_url TEXT NULL,                -- Reservation URL
+  email TINYTEXT NULL,                      -- Main E-Mail address for this member
+  logo TINYTEXT NULL,                       -- Member logo
+  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
+  video_url TINYTEXT NULL,                  -- Video URL
+  video_file TINYTEXT NULL,                 -- Video File Name
+  video_title TINYTEXT NULL,                -- Video Title
+  video_descr TEXT NULL,                    -- Video Description
+  video_type INT NULL,                      -- Video Type - See plugin.ini video type table.
+  live_cam_url TINYTEXT NULL,               -- Live Cam URL
+  live_cam_title TINYTEXT NULL,             -- Live Cam Title
+  live_cam_descr TEXT NULL,                 -- Live Cam Description
+  live_cam_type INT NULL,                   -- Live Cam Type - See plugin.ini video type table.
+  mailing_addr1 TINYTEXT NULL,              -- Mailing Address 1
+  mailing_addr2 TINYTEXT NULL,              -- Mailing Address 2
+  mailing_city INT NULL,                    -- Mailing City  (Pointer to City in cities table)
+  mailing_state TINYTEXT NULL,              -- Mailing State (Two character state code - matches states.ini entries)
+  mailing_zip TINYTEXT NULL,                -- Mailing ZIP/Postal code
+  notes TEXT NULL,                          -- General notes - Not displayed in front-end
+  create_time TIMESTAMP NULL,               -- Create date/time
+  modify_time TIMESTAMP NULL,               -- Last update date/time
+  PRIMARY KEY (id),
+  INDEX(status),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(region),
+  INDEX(county),
+  FULLTEXT KEY member_name (member_name)
+);
+
+----
+
+-- Member type - Can be used to assign members to different "classes" of membership (i.e. Full, Associate, Premium)
+-- Mostly for internal use by the member organization, but could be displayed - Consider a short_description if they are.
+CREATE TABLE {prefix}member_type (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of member type
+  descr TINYTEXT NULL,                      -- Description of member type
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Regions - Used to segment members into various geographical regions - can be cities, counties, or other logical regions
+CREATE TABLE {prefix}regions (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of region
+  descr TEXT NULL,                          -- Description of region
+  short_descr TINYTEXT NULL,                -- Short description of region
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Counties
+CREATE TABLE {prefix}counties (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of county
+  descr TEXT NULL,                          -- Description of county
+  short_descr TINYTEXT NULL,                -- Short description of county
+  PRIMARY KEY (id)
+);
+
+----
+
+-- File Library Cateogries - used with "Files Library" - Created due to PDF failures in WordPress Media Library
+CREATE TABLE {prefix}file_library_categories (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Name of this category
+  descr TEXT NULL,                          -- Description of this category
+  short_descr TINYTEXT NULL,                -- Short description of this category
+  parent INT NULL,                          -- Pointer to parent category in this table - if there is one
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Files Library - Files are stored under /wp-content/uploads/glm-member-db/filesLibrary/
+CREATE TABLE {prefix}file_library (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,                       -- Original name of the file - might be URL if copied via HTTP
+  file_name TINYTEXT NULL,                  -- Stored file name for the file
+  descr TEXT NULL,                          -- Description
+  title TINYTEXT NULL,                      -- File title
+  last_access_time DATETIME NULL,           -- Upload time or last access time
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20))
+);
+
+----
+
+-- General settings available on Management page in admin - Only 1 entry in this table
+-- Items in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_general (
+  id INT NOT NULL AUTO_INCREMENT,
+  admin_debug BOOLEAN DEFAULT '0',
+  admin_debug_verbose BOOLEAN DEFAULT '0',
+  front_debug BOOLEAN DEFAULT '0',
+  front_debug_verbose BOOLEAN DEFAULT '0',
+  enable_members BOOLEAN DEFAULT '1',
+  selected_map_interface SMALLINT DEFAULT '1',
+  leaflet_tile_server TINYTEXT DEFAULT '',
+  leaflet_tile_server_key TINYTEXT DEFAULT '',
+  google_maps_api_key TINYTEXT DEFAULT '',
+  maps_default_lat FLOAT DEFAULT '45.3749',
+  maps_default_lon FLOAT DEFAULT '-84.9592',
+  maps_default_zoom INTEGER DEFAULT '10',
+  time_zone TINYTEXT DEFAULT NULL,
+  canonical_member_page TINYTEXT DEFAULT NULL,
+  phone_infix TINYTEXT DEFAULT NULL,
+  phone_format TINYTEXT DEFAULT NULL,
+  default_state TINYTEXT DEFAULT NULL,
+  enable_counties BOOLEAN DEFAULT '0',
+  enable_multiple_profiles BOOLEAN DEFAULT '0',
+  enable_single_profile BOOLEAN DEFAULT '0',            -- Hide the add profile and clone profile links/buttons
+  enable_member_reports BOOLEAN DEFAULT '1',
+  enable_caching BOOLEAN DEFAULT '1',
+  enable_contact_edit_only BOOLEAN DEFAULT '0',
+  memb_info_location BOOLEAN DEFAULT '1',
+  memb_info_contact BOOLEAN DEFAULT '1',
+  memb_info_categories BOOLEAN DEFAULT '1',
+  memb_info_images BOOLEAN DEFAULT '1',
+  memb_info_files BOOLEAN DEFAULT '1',
+  memb_info_video BOOLEAN DEFAULT '1',
+  memb_info_cam BOOLEAN DEFAULT '1',
+  file_library BOOLEAN DEFAULT '0',
+  list_show_map BOOLEAN DEFAULT '1',
+  list_show_featured BOOLEAN DEFAULT '0',
+  list_show_featured_count SMALLINT DEFAULT '3',
+  list_show_list BOOLEAN DEFAULT '1',
+  list_order_list SMALLINT DEFAULT '10',
+  list_pagination BOOLEAN DEFAULT '1',
+  list_pagination_count SMALLINT DEFAULT '20',
+  list_show_search_filters_opened BOOLEAN DEFAULT '0',
+  list_show_search BOOLEAN DEFAULT '1',
+  list_show_search_text BOOLEAN DEFAULT '1',
+  list_show_search_category BOOLEAN DEFAULT '1',
+  list_show_search_amenities BOOLEAN DEFAULT '1',
+  list_show_search_region BOOLEAN DEFAULT '1',
+  list_show_search_alpha BOOLEAN DEFAULT '1',
+  list_floating_search BOOLEAN DEFAULT '0',
+  list_floating_search_distance_top INTEGER DEFAULT '0',    -- How far from the top the sticky Search/Filters box should hover
+  list_show_detail_link BOOLEAN DEFAULT '1',
+  list_show_logo BOOLEAN DEFAULT '1',
+  list_logo_size TINYTEXT NULL,
+  list_logo_for_mobile BOOLEAN DEFAULT '1',
+  list_show_address BOOLEAN DEFAULT '1',
+  list_show_street BOOLEAN DEFAULT '1',
+  list_show_citystatezip BOOLEAN DEFAULT '1',
+  list_show_country BOOLEAN DEFAULT '1',
+  list_show_region BOOLEAN DEFAULT '1',
+  list_show_descr BOOLEAN DEFAULT '0',
+  list_show_short_descr BOOLEAN DEFAULT '1',
+  list_show_phone BOOLEAN DEFAULT '1',
+  list_show_tollfree BOOLEAN DEFAULT '1',
+  list_show_url BOOLEAN DEFAULT '1',
+  list_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_show_email BOOLEAN DEFAULT '1',
+  list_show_categories BOOLEAN DEFAULT '0',
+  list_show_creditcards BOOLEAN DEFAULT '0',
+  list_show_amenities BOOLEAN DEFAULT '0',
+  list_show_logo_filler BOOLEAN DEFAULT '1',
+  list_show_live_cam BOOLEAN DEFAULT '1',
+  list_map_show_opened BOOLEAN DEFAULT '0',
+  list_map_show_detaillink BOOLEAN DEFAULT '1',
+  list_map_show_logo BOOLEAN DEFAULT '0',
+  list_map_logo_size TINYTEXT NULL,
+  list_map_show_descr BOOLEAN DEFAULT '0',
+  list_map_show_short_descr BOOLEAN DEFAULT '1',
+  list_map_show_address BOOLEAN DEFAULT '1',
+  list_map_show_street BOOLEAN DEFAULT '1',
+  list_map_show_citystatezip BOOLEAN DEFAULT '1',
+  list_map_show_country BOOLEAN DEFAULT '1',
+  list_map_show_region BOOLEAN DEFAULT '1',
+  list_map_show_phone BOOLEAN DEFAULT '1',
+  list_map_show_tollfree BOOLEAN DEFAULT '1',
+  list_map_show_url BOOLEAN DEFAULT '1',
+  list_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  list_map_show_email BOOLEAN DEFAULT '1',
+  list_map_show_categories BOOLEAN DEFAULT '0',
+  list_map_show_creditcards BOOLEAN DEFAULT '0',
+  list_map_show_amenities BOOLEAN DEFAULT '0',
+  list_show_packages BOOLEAN DEFAULT '0',
+  list_show_packages_link BOOLEAN DEFAULT '0',
+  list_header_text TINYTEXT DEFAULT NULL,
+  detail_auto_expand_sections BOOLEAN DEFAULT '0',
+  detail_show_map BOOLEAN DEFAULT '1',
+  detail_show_directions BOOLEAN DEFAULT '1',
+  detail_show_logo BOOLEAN DEFAULT '1',
+  detail_logo_size TINYTEXT NULL,
+  detail_show_descr BOOLEAN DEFAULT '1',
+  detail_show_short_descr BOOLEAN DEFAULT '0',
+  detail_show_address BOOLEAN DEFAULT '1',
+  detail_show_street BOOLEAN DEFAULT '1',
+  detail_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_show_country BOOLEAN DEFAULT '1',
+  detail_show_region BOOLEAN DEFAULT '1',
+  detail_show_phone BOOLEAN DEFAULT '1',
+  detail_show_tollfree BOOLEAN DEFAULT '1',
+  detail_show_url BOOLEAN DEFAULT '1',
+  detail_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_show_email BOOLEAN DEFAULT '1',
+  detail_show_categories BOOLEAN DEFAULT '0',
+  detail_show_creditcards BOOLEAN DEFAULT '0',
+  detail_show_amenities BOOLEAN DEFAULT '1',
+  detail_show_imagegallery BOOLEAN DEFAULT '1',
+  detail_show_coupons BOOLEAN DEFAULT '0',
+  detail_show_packages BOOLEAN DEFAULT '0',
+  detail_show_events BOOLEAN DEFAULT '0',
+  detail_show_video BOOLEAN DEFAULT '0',
+  detail_show_live_cam BOOLEAN DEFAULT '0',
+  detail_top_offset_autoscroll INTEGER DEFAULT '0', -- Determines the distance from the top when autoscrolling to a section on member detail pages
+  detail_map_show_logo BOOLEAN DEFAULT '0',
+  detail_map_logo_size TINYTEXT NULL,
+  detail_map_show_descr BOOLEAN DEFAULT '0',
+  detail_map_show_short_descr BOOLEAN DEFAULT '1',
+  detail_map_show_address BOOLEAN DEFAULT '1',
+  detail_map_show_street BOOLEAN DEFAULT '1',
+  detail_map_show_citystatezip BOOLEAN DEFAULT '1',
+  detail_map_show_country BOOLEAN DEFAULT '1',
+  detail_map_show_region BOOLEAN DEFAULT '1',
+  detail_map_show_phone BOOLEAN DEFAULT '1',
+  detail_map_show_tollfree BOOLEAN DEFAULT '1',
+  detail_map_show_url BOOLEAN DEFAULT '1',
+  detail_map_show_url_newtarget BOOLEAN DEFAULT '1',
+  detail_map_show_email BOOLEAN DEFAULT '1',
+  detail_map_show_categories BOOLEAN DEFAULT '0',
+  detail_map_show_creditcards BOOLEAN DEFAULT '0',
+  detail_map_show_amenities BOOLEAN DEFAULT '0',
+  members_only_support_email TINYTEXT DEFAULT '',
+  members_only_support_phone TINYTEXT DEFAULT '',
+  updates_notification_to TINYTEXT DEFAULT '',      -- To email address for the notification email
+  updates_notification_from TINYTEXT DEFAULT '',    -- From header for the notification email
+  updates_notification TEXT DEFAULT '',             -- Notification message
+  short_desc_char_limit INTEGER DEFAULT '120',      -- How many characters the short description is limited to - also used for importing
+  use_cluster_markers BOOLEAN DEFAULT '0',          -- Flag to say if cluster markers should be use in maps
+  recaptcha_site_key TINYTEXT DEFAULT '',           -- reCAPTCHA site key
+  recaptcha_secret_key TINYTEXT DEFAULT '',         -- reCAPTCHA secret key
+  recaptcha_header_code TEXT DEFAULT '',            -- reCAPTCHA code for page header
+  recaptcha_form_code TEXT DEFAULT '',              -- reCAPTCHA code for captcha form field
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default entry
+INSERT INTO {prefix}settings_general
+    ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size,
+        list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles, enable_member_reports, enable_caching, updates_notification, enable_single_profile )
+   VALUES
+    ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20, 0, 0, 1, 1,
+        'A member has updated their record and is now in a pending state.', 0)
+;
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Terms in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+  id INT NOT NULL AUTO_INCREMENT,
+  term_admin_menu_members TINYTEXT NULL,
+  term_admin_menu_member_list TINYTEXT NULL,
+  term_admin_menu_member TINYTEXT NULL,
+  term_admin_menu_configure TINYTEXT NULL,
+  term_admin_menu_settings TINYTEXT NULL,
+  term_admin_menu_shortcodes TINYTEXT NULL,
+  term_admin_menu_members_dashboard TINYTEXT NULL,
+  term_admin_menu_members_list TINYTEXT NULL,
+  term_admin_menu_members_reports TINYTEXT NULL,
+  term_admin_menu_member_dashboard TINYTEXT NULL,
+  term_admin_menu_member_info TINYTEXT NULL,
+  term_admin_menu_member_locations TINYTEXT NULL,
+  term_admin_menu_member_facilities TINYTEXT NULL,
+  term_admin_menu_member_attractions TINYTEXT NULL,
+  term_admin_menu_member_contacts TINYTEXT NULL,
+  term_admin_menu_configure_member_types TINYTEXT NULL,
+  term_admin_menu_configure_member_cats TINYTEXT NULL,
+  term_admin_menu_configure_accom_types TINYTEXT NULL,
+  term_admin_menu_configure_amenities TINYTEXT NULL,
+  term_admin_menu_configure_cities TINYTEXT NULL,
+  term_admin_menu_configure_counties TINYTEXT NULL,
+  term_admin_menu_configure_regions TINYTEXT NULL,
+  term_admin_menu_settings_general TINYTEXT NULL,
+  term_admin_menu_settings_terms TINYTEXT NULL,
+  term_admin_menu_settings_development TINYTEXT NULL,
+  term_member TINYTEXT NULL,
+  term_member_cap TINYTEXT NULL,
+  term_member_plur TINYTEXT NULL,
+  term_member_plur_cap TINYTEXT NULL,
+  term_location TINYTEXT NULL,
+  term_location_cap TINYTEXT NULL,
+  term_location_plur TINYTEXT NULL,
+  term_location_plur_cap TINYTEXT NULL,
+  term_county TINYTEXT NULL,
+  term_county_cap TINYTEXT NULL,
+  term_county_plur TINYTEXT NULL,
+  term_county_plur_cap TINYTEXT NULL,
+  term_facility TINYTEXT NULL,
+  term_facility_cap TINYTEXT NULL,
+  term_facility_plur TINYTEXT NULL,
+  term_facility_plur_cap TINYTEXT NULL,
+  term_attraction TINYTEXT NULL,
+  term_attraction_cap TINYTEXT NULL,
+  term_attraction_plur TINYTEXT NULL,
+  term_attraction_plur_cap TINYTEXT NULL,
+  term_contact TINYTEXT NULL,
+  term_contact_cap TINYTEXT NULL,
+  term_contact_plur TINYTEXT NULL,
+  term_contact_plur_cap TINYTEXT NULL,
+  term_webcam_cap TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Default terms entry
+INSERT INTO {prefix}settings_terms
+    (
+    id,
+    term_admin_menu_members,
+    term_admin_menu_member_list,
+    term_admin_menu_member,
+    term_admin_menu_configure,
+    term_admin_menu_settings,
+    term_admin_menu_shortcodes,
+    term_admin_menu_members_dashboard,
+    term_admin_menu_members_list,
+    term_admin_menu_members_reports,
+    term_admin_menu_member_dashboard,
+    term_admin_menu_member_info,
+    term_admin_menu_member_locations,
+    term_admin_menu_member_facilities,
+    term_admin_menu_member_attractions,
+    term_admin_menu_member_contacts,
+    term_admin_menu_configure_member_types,
+    term_admin_menu_configure_member_cats,
+    term_admin_menu_configure_accom_types,
+    term_admin_menu_configure_amenities,
+    term_admin_menu_configure_cities,
+    term_admin_menu_configure_counties,
+    term_admin_menu_configure_regions,
+    term_admin_menu_settings_general,
+    term_admin_menu_settings_terms,
+    term_admin_menu_settings_development,
+    term_member,
+    term_member_cap,
+    term_member_plur,
+    term_member_plur_cap,
+    term_location,
+    term_location_cap,
+    term_location_plur,
+    term_location_plur_cap,
+    term_county,
+    term_county_cap,
+    term_county_plur,
+    term_county_plur_cap,
+    term_facility,
+    term_facility_cap,
+    term_facility_plur,
+    term_facility_plur_cap,
+    term_attraction,
+    term_attraction_cap,
+    term_attraction_plur,
+    term_attraction_plur_cap,
+    term_contact,
+    term_contact_cap,
+    term_contact_plur,
+    term_contact_plur_cap,
+    term_webcam_cap
+    )
+   VALUES
+    (
+    1,
+    'Members',
+    'Member',
+    'Member',
+    'Configure',
+    'Management',
+    'Shortcodes',
+    'Dashboard',
+    'Member List',
+    'Reports',
+    'Member Dashboard',
+    'Member Info',
+    'Locations',
+    'Facilities',
+    'Attractions',
+    'Contacts',
+    'Member Types',
+    'Member Categories',
+    'Accommodation Types',
+    'Amenities',
+    'Cities',
+    'Counties',
+    'Regions',
+    'General Settings',
+    'Terms & Phrases',
+    'Development',
+    'member',
+    'Member',
+    'members',
+    'Members',
+    'location',
+    'Location',
+    'locations',
+    'Locations',
+    'county',
+    'County',
+    'counties',
+    'Counties',
+    'facility',
+    'Facility',
+    'facilities',
+    'Facilities',
+    'attraction',
+    'Attraction',
+    'attractions',
+    'Attractions',
+    'contact',
+    'Contact',
+    'contacts',
+    'Contacts',
+    'Webcam'
+    )
+;
+
+----
+
+-- Shortcode Output Cache
+CREATE TABLE {prefix}cache (
+    shortcode TINYTEXT NULL,
+    cache_code TINYTEXT NOT NULL,
+    created DATETIME NULL,
+    html MEDIUMTEXT NULL,
+    PRIMARY KEY (cache_code(20)),
+    INDEX (created)
+);
+
+----
+
+-- Theme Settings - Only 1 entry in this table
+CREATE TABLE {prefix}settings_theme (
+    id INT NOT NULL AUTO_INCREMENT,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Default Theme Settings entry
+INSERT INTO {prefix}settings_theme
+    (
+    id
+    )
+   VALUES
+    (
+    1
+    )
+;
+
+----
+
+-- Member Email Notifications
+CREATE TABLE {prefix}email_notifications (
+    id INT NOT NULL AUTO_INCREMENT,
+    notification_message TEXT NULL,
+    declined_message TEXT NULL,
+    approved_message TEXT NULL,
+    to_email TINYTEXT NULL,
+    from_email TINYTEXT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default email notifications
+INSERT INTO {prefix}email_notifications
+    ( id, notification_message, declined_message, approved_message )
+VALUES
+    ( 1, 'A member has requested a profile update.', 'Your profile update has been declined.', 'Your profile has been approved!' );
+
index 745e8f8..66131ba 100755 (executable)
@@ -74,6 +74,7 @@ $glmMembersDbVersions = array(
     '1.1.40' => array('version' => '1.1.40', 'tables' => 23, 'date' => '09/25/18'),
     '1.1.41' => array('version' => '1.1.41', 'tables' => 23, 'date' => '10/12/18'),
     '1.1.42' => array('version' => '1.1.42', 'tables' => 23, 'date' => '10/29/18'),
+    '1.1.43' => array('version' => '1.1.43', 'tables' => 23, 'date' => '11/07/18'),
 );
 
 
diff --git a/setup/databaseScripts/update_database_V1.1.43.sql b/setup/databaseScripts/update_database_V1.1.43.sql
new file mode 100755 (executable)
index 0000000..af377a7
--- /dev/null
@@ -0,0 +1,11 @@
+-- Gaslight Media Members Database
+-- File Created: 2018-10-12
+-- Database Version: 1.1.41
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Add county to cities table
+ALTER TABLE {prefix}cities ADD COLUMN county INT NULL;   -- County reference to county table
+
index ac97f40..91407bc 100644 (file)
@@ -206,8 +206,11 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) {
             'action'     => 'interactivemap',
             'table'      => false,
             'attributes' => array(
-                'client'          => 'uptra',
-                'main-level-cats' => false,
+                'client'            => 'uptra',
+                'main-level-cats'   => false,
+                'main-level-colors' => false,
+                'lat-bounds'        => false,
+                'lon-bounds'        => false,
             ),
         ),
     );
index cf10728..adf1080 100644 (file)
@@ -6,6 +6,9 @@
         <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
             <input type="hidden" name="glm_action" value="cities">
             <input type="hidden" name="option" value="addNew">
+            {if !$settings.enable_counties}
+                <input type="hidden" name="county" value="0">
+            {/if}
             <table class="glm-admin-table">
                 <tr>
                     <th class="glm-required">City Name:</th>
                         <input type="text" name="name" class="glm-form-text-input">
                     </td>
                 </tr>
+                {if $settings.enable_counties}
+                    <tr>
+                        <th>{$terms.term_county_cap}:</th>
+                        <td>
+                            <select name="county">
+                                <option value="0"></option>
+                                {foreach $counties as $county}
+                                    <option value="{$county.id}">{$county.name}</option>
+                                {/foreach}
+                            </select>
+                        </td>
+                    </tr>
+                {/if}
             </table>
             <p><span class="glm-required">*</span> Required</p>
             <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
@@ -45,6 +61,9 @@
             <input type="hidden" name="glm_action" value="cities">
             <input type="hidden" name="option" value="update">
             <input id="editCityID" type="hidden" name="id" value="">
+            {if !$settings.enable_counties}
+                <input type="hidden" name="county" value="0">
+            {/if}
             <table class="glm-admin-table">
                 <tr>
                     <th class="glm-required">City Name:</th>
                         <input id="editCityName" type="text" name="name" class="glm-form-text-input">
                     </td>
                 </tr>
+                {if $settings.enable_counties}
+                    <tr>
+                        <th>{$terms.term_county_cap}:</th>
+                        <td>
+                            <select id="editCounty" name="county">
+                                <option value="0"></option>
+                                {foreach $counties as $county}
+                                    <option value="{$county.id}">{$county.name}</option>
+                                {/foreach}
+                            </select>
+                        </td>
+                    </tr>
+                {/if}
             </table>
             <p><span class="glm-required">*</span> Required</p>
             <a id="editCityCancel" class="button button-primary glm-right">Cancel</a>
             <tr class="alternate">
         {/if}
                 <td>
-                    <a class="editCity" data-cityID="{$t.id}">{$t.name}</a>
+                    <a class="editCity" data-cityID="{$t.id}" data-county="{$t.county}">{$t.name}</a>
                 </td>
 
                 <td>
                     {if $t.id|array_key_exists:$citiesWithMembers}
                         <span>Assigned to {$citiesWithMembers[$t.id]|count} members </span>
                         <div class="showMembersWithCityButton button glm-button-small" data-cityID="{$t.id}">view</div>
-                        <div class="deleteCityWithMembersButton button button-secondary glm-button-small glm-right" data-cityID="{$t.id}">Delete</div>   
-                    {else}                     
+                        <div class="deleteCityWithMembersButton button button-secondary glm-button-small glm-right" data-cityID="{$t.id}">Delete</div>
+                    {else}
                         <span>Not assigned to any members</span>
                         <div class="deleteCityButton button button-secondary glm-button-small glm-right" data-cityID="{$t.id}">Delete</div>
                     {/if}
-                    
+
                 </td>
             </tr>
     {/foreach}
             });
             $('.editCity').click( function() {
                 var cityID = $(this).attr('data-cityID');
+                var county = $(this).data('county');
                 var cityName = $(this).text();
                 $('#editCityID').val(cityID);
                 $('#editCityName').val(cityName.trim());
+                if ( county ) {
+                    $('#editCounty').val(county);
+                } else {
+                    $('#editCounty').val(0);
+                }
                 $("#editCityDialog").dialog("open");
             });
             $('#editCityCancel').click( function() {
             $('#deleteCityCancel').click( function() {
                 $("#deleteCityDialog").dialog("close");
             });
-            
+
             var citiesWithMembers = '{$citiesWithMembersJSON}';
             citiesWithMembers = JSON.parse(citiesWithMembers);
             $('.deleteCityWithMembersButton').click( function() {
-                
+
                 id = $(this).attr('data-cityID');
-                
+
                 var citiesString = '<ul>';
                 //console.log(citiesString);
                 $.each(citiesWithMembers[id], function(memberID, memberName) {
                     citiesString += '<li><a href=\"{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member=' + memberID + '&memberInfo=' + memberID + '\" target=\"blank\">' + memberName + '</a></li>';
                 });
                 citiesString += '</ul>';
-                
+
                 $("#showMembersWithCityDialog .cityMembers").html(citiesString);
                 $("#showMembersWithCityDialog").dialog("open");
             });
index 29054e2..632213a 100644 (file)
@@ -1,11 +1,15 @@
 <script>
-    glm_ajax_url = '{$ajaxUrl}';
-    glm_memberCats = [
-        {foreach $categories as $catId => $cat}
-            {$catId}{if !$cat@last},{/if}
-        {/foreach}
-    ];
+    var glm_ajax_url   = '{$ajaxUrl}';
+    var glm_assets_url = '{$assetsUrl}';
+    var glm_memberCats = [ {foreach $categories as $catId => $cat} {$catId}{if !$cat@last},{/if} {/foreach} ];
+    var glm_map_colors = [];
+{foreach $colors as $c_id => $color}
+    glm_map_colors['{$c_id}'] = '{$color}';
+{/foreach}
+    glm_lat_bounds = '{$latbounds}';
+    glm_lon_bounds = '{$lonbounds}';
 </script>
+
 {literal}
 <style>
     #category {display: none;}
@@ -383,6 +387,12 @@ div#memberLocations {
     overflow: scroll !important;
     height: 400 !important;
 }
+.infoWindow {
+    text-align: left;
+}
+#MapCountiesCites a {
+    font-size: 13px;
+}
 </style>
 {/literal}