Added support for canonical pages and fixed a number of import issues.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 14 Oct 2015 20:12:56 +0000 (16:12 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 14 Oct 2015 20:12:56 +0000 (16:12 -0400)
23 files changed:
activate.php
classes/data/dataMemberInfo.php
classes/data/dataMembers.php
classes/glmPluginSupport.php
config.php
controllers/admin.php
controllers/front.php
glm-member-db.php
lib/GlmDataAbstract/.~lock.documentation.odt# [deleted file]
lib/GlmDataAbstract/DataAbstract.php
misc/databaseScripts/create_database_V0.1.sql [deleted file]
misc/databaseScripts/create_database_V1.0.30.sql [new file with mode: 0644]
misc/databaseScripts/drop_database_V0.1.sql [deleted file]
misc/databaseScripts/drop_database_V1.0.30.sql [new file with mode: 0644]
misc/databaseScripts/update_database_V1.0.30.php [new file with mode: 0644]
misc/databaseScripts/update_database_V1.0.30.sql [new file with mode: 0644]
models/admin/management/development.php
models/admin/management/import.php
models/front/members/detail.php
models/front/members/list.php
views/admin/member/index.html
views/admin/member/memberInfo.html
views/admin/shortcodes/index.html

index 9394f92..db1fa88 100644 (file)
@@ -71,8 +71,8 @@ class glmMembersPluginActivate extends glmPluginSupport
 
             $this->checkErrorScrape();
 
-            // Check the database
-            if (!$this->checkDatabase()) {
+            // Check the database and permit installation of a new database if it doesn't exist;
+            if (!$this->checkDatabase('install')) {
 
                 // There was some kind of dataase failure, so die to prevent WordPress from marking plugin as activated.
                 die();
index 110f5c1..fa5931a 100644 (file)
@@ -132,11 +132,16 @@ class GlmDataMemberInfo extends GlmDataAbstract
                                'use' => 'lg'
                        ),
 
-                       // Member Name (stored by member updates) for sorting
-                       'member_slug' => array(
-                        'field' => 'member_slug',
-                               'type' => 'text',
-                               'use' => 'a'
+                       // Member Slug
+                       'member_slug' => array (
+                               'field' => 'member',
+                               'as' => 'member_slug',
+                               'type' => 'pointer',
+                            'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+                            'p_field' => 'member_slug',
+                                   'p_static' => true,
+                               'required' => true,
+                               'use' => 'gle'
                        ),
 
                        // Member Pointer index
@@ -333,7 +338,7 @@ class GlmDataMemberInfo extends GlmDataAbstract
        /*
         * Find the active member info record for a specific member ID
         *
-        * @param integer $member ID of the member
+        * @param integer $member ID of the member name
         *
         * @return integer Member info record ID or false if not found
         */
index 5a2efb7..2884570 100644 (file)
@@ -145,6 +145,14 @@ class GlmDataMembers extends GlmDataAbstract {
                                                'use' => 'a'
                                ),
 
+                       // Member Name (stored by member updates) for sorting
+                       'member_slug' => array(
+                               'field' => 'member_slug',
+                               'type' => 'text',
+                               'required' => true,
+                               'use' => 'a'
+                       ),
+
                        // Date created
                        'created' => array (
                                'field' => 'created',
index 0b6cb65..a1d0c9b 100644 (file)
@@ -36,7 +36,8 @@ class GlmPluginSupport
      */
     public $dbVersions = array(
             '0.1' => array('version' => '0.1', 'tables' => 26),
-            '1.0.28' => array('version' => '1.0.28', 'tables' => 26)
+            '1.0.28' => array('version' => '1.0.28', 'tables' => 26),
+            '1.0.30' => array('version' => '1.0.30', 'tables' => 26)
     );
 
     /*
@@ -177,15 +178,16 @@ class GlmPluginSupport
     /*
      * Check if database is installed and if it matches the current version
      *
-     * @param string $capability Name of capability to add
+     * @param string $option Set to 'install' to permit installation of the database.
      * @param string $default Whether capability should be on by default
      *
      * @return void
      * @access private
      */
-    public function checkDatabase ()
+    public function checkDatabase ($option = false)
     {
 
+
         $dbVersion = get_option('glmMembersDatabaseDbVersion');
         $db_setup_status = false;
 
@@ -225,6 +227,11 @@ class GlmPluginSupport
         // If glmMembersDatabaseDbVersion is not set, install current version
         if (!$dbVersion) {
 
+            // If $option is not 'install', then don't do it;
+            if ($option != 'install') {
+                return false;
+            }
+
             // Get current database version
             $dbVersion = GLM_MEMBERS_PLUGIN_DB_VERSION;
 
@@ -293,9 +300,6 @@ class GlmPluginSupport
                     // Otherwise if it's already been found and $ver is not the new target version
                 } elseif ($curVerFound && $dbVersion != GLM_MEMBERS_PLUGIN_DB_VERSION) {
 
-                    // Build database update script name
-                    $updateScript = $dbVersion.'_'.$ver;
-
                     // Read in Database creation script
                     $sqlFile = GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/update_database_V'.$ver.'.sql';
                     $sql = file_get_contents($sqlFile);
@@ -322,10 +326,6 @@ class GlmPluginSupport
 
                     // If there were no errors
                     if ($queryError == '') {
-
-
-
-
                         $this->addNotice('The database for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin has been updated '
                                 .'from V'.$dbVersion.'_V'.$ver.'.');
                     } else {
@@ -335,9 +335,10 @@ class GlmPluginSupport
                         $this->addNotice('<b>Database Update Error:</b> '.$queryError, 'Alert');
                     }
 
-                }
+                    $dbVersion = $ver;
+                    $db_setup_status = true;
 
-                $dbVersion = $ver;
+                }
 
                 // Save the new version. If we've had a problem updating the database, then stop here.
                 if ($db_setup_status) {
@@ -367,7 +368,6 @@ class GlmPluginSupport
         return $db_setup_status;
     }
 
-
 }
 
 ?>
\ No newline at end of file
index fa85c65..7284d12 100644 (file)
@@ -21,8 +21,8 @@ $config['countries'] = $countryData['countries'];
 // Read in Settings and Terms from database
 $settings = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_general WHERE id = 1;", ARRAY_A);
 unset($settings['id']);
-
 $config['settings'] = $settings;
+
 $terms = $wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "settings_terms WHERE id = 1;", ARRAY_A);
 unset($terms['id']);
 $config['terms'] = $terms;
index 2f10f8a..ca31c6b 100644 (file)
@@ -595,6 +595,9 @@ class glmMembersAdmin extends GlmPluginSupport
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
 
+            // Also turn on SQL error messages
+            $this->wpdb->show_errors();
+
             // If debug is VERBOSE
             $consts = get_defined_constants(true);
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
index d0ba49b..ff8a255 100644 (file)
@@ -82,7 +82,12 @@ class glmMembersFront extends GlmPluginSupport
                         $this,
                         'glm_members_insert_rewrite_rules'
                 ));
-        add_action( 'wp_loaded',
+        add_filter('query_vars',
+                array(
+                        $this,
+                        'glm_members_RewriteQueryVars'
+                ));
+        add_filter( 'init',
                 array(
                         $this,
                         'glm_members_flush_rules'
@@ -112,25 +117,28 @@ class glmMembersFront extends GlmPluginSupport
     // Flush rules if the member detail rewrite hasn't been included
     function glm_members_flush_rules(){
         $rules = get_option( 'rewrite_rules' );
-//        if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/(.*+)/?$'] ) ) {
+        if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] ) ) {
             global $wp_rewrite;
             $wp_rewrite->flush_rules();
-  //      }
+        }
     }
 
     // Add the rewrite rule for the member detail page
     function glm_members_insert_rewrite_rules( $rules )
     {
         $newrules = array();
-//        $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/?$'] = 'index.php?pagename=$matches[1]&member=$matches[2]';
-          $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/?$'] = 'index.php?pagename=$matches[1]&member=$matches[2]';
-        $ret = $newrules + $rules;
-var_dump($newrules);
-echo "<P>";var_dump($_REQUEST);
-//echo "<pre>".print_r($ret,1)."</pre>";
-        return $ret;
+        $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] = 'index.php?pagename=$matches[1]&memberslug=$matches[2]';
+        return $newrules + $rules;
+    }
+
+    // Have WP store memberid value so we can read it after rewrites
+    function glm_members_RewriteQueryVars($vars)
+    {
+        array_push($vars, 'memberslug');
+        return $vars;
     }
 
+
     /**
      * Setup inclusion of front-end scripts and css
      *
@@ -235,7 +243,8 @@ echo "<P>";var_dump($_REQUEST);
                         'alpha' => false,
                         'search' => false,
                         'amenities' => false,
-                        'detail-page' => false
+                        'detail-page' => false,
+                        'show' => false
                     ),
                     $atts,
                     'glm-members'
@@ -247,7 +256,8 @@ echo "<P>";var_dump($_REQUEST);
                 $request = shortcode_atts(
                     array(
                         'map' => true,
-                        'id' => false
+                        'id' => false,
+                        'show' => false
                     ),
                     $atts,
                     'glm-members'
@@ -269,6 +279,9 @@ echo "<P>";var_dump($_REQUEST);
 
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
 
+            // Also turn on SQL error messages
+            $this->wpdb->show_errors();
+
             // Get all defiend constants then if not VERBOSE select out only user contstants
             $consts = get_defined_constants(true);
             if (!GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
@@ -427,6 +440,13 @@ echo "<P>";var_dump($_REQUEST);
             $view = 'front/error/index.html';
         }
 
+        // Check for modified settings to save in conf
+        if (isset($results['settings'])) {
+            while (list($key, $val) = each($results['settings'])) {
+                $this->config['settings'][$key] = $val;
+            }
+        }
+
         /*
          * Merge data returned from the model with the selected view
          */
index c75b940..e6b5d7e 100644 (file)
  *  plugin version where there was a change in the database.
  *
  *  Updates to checkDatabase() in glmPluginSupport.php must be
- *  made together with the DB_VERSION below.
+ *  made together with the DB_VERSION below. ONLY bump the DB
+ *  version when there's a change in the database!! Use the
+ *  version nunmber of that release for the DB version.
  */
 define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.28');
-define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.0.28');
+define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.0.30');
 
 /*
  * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
diff --git a/lib/GlmDataAbstract/.~lock.documentation.odt# b/lib/GlmDataAbstract/.~lock.documentation.odt#
deleted file mode 100644 (file)
index 0e5b58c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-,cscott,Ubuntu-1404,24.09.2015 14:41,file:///home/cscott/.config/libreoffice/4;
\ No newline at end of file
index cb16452..a7cc1f2 100755 (executable)
@@ -649,14 +649,12 @@ abstract class GlmDataAbstract
                     reset($p_list);
                     foreach ($p_list as $p) {
 
-                        if ($this->optionIncludeSelectListData) {
-                           $pick_list[$p['p_id']] = array(
-                                   'value'   => $p['p_id'],
-                                   'name'    => $p['p_value'],
-                                   'nameEsc' => addslashes($p['p_value']),
-                                   'default' => ($p['p_id'] == $p_value)
-                           );
-                       }
+                        $pick_list[$p['p_id']] = array(
+                                   'value'   => $p['p_id'],
+                                   'name'    => $p['p_value'],
+                                   'nameEsc' => addslashes($p['p_value']),
+                                   'default' => ($p['p_id'] == $p_value)
+                           );
 
                         // Check for selected option
                         if ($p['p_id'] == $p_value) {
diff --git a/misc/databaseScripts/create_database_V0.1.sql b/misc/databaseScripts/create_database_V0.1.sql
deleted file mode 100644 (file)
index 3fc87ce..0000000
+++ /dev/null
@@ -1,756 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.1 
--- Database Creation Script
--- 
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
-
-
-CREATE TABLE {prefix}accommodation_types (
-  id INT NOT NULL AUTO_INCREMENT,
-  facility_type INT NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  PRIMARY KEY (id),
-  INDEX(facility_type),
-  INDEX(name(20))
-);
-
-----
-
-CREATE TABLE {prefix}accommodations (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  name TINYTEXT NULL,
-  accommodation_type INT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  quant INT NULL,
-  reservation_url TINYTEXT NULL,
-  reservation_id TINYTEXT NULL,
-  year_round TINYINT(1) NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(accommodation_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}accounts (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,
-  payment_type INT NULL,
-  invoice_delivery INT NULL,
-  PRIMARY KEY (id),
-  INDEX(member)
-);
-
-----
-
-CREATE TABLE {prefix}activties (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  activity_type INT NULL,
-  facility INT NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  phone TINYTEXT NULL,
-  url TINYTEXT NULL,
-  notes TEXT NULL,
-  create_time TIMESTAMP NULL,
-  modify_time TIMESTAMP NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(activity_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}amenities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active TINYINT(1) NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  ref_type INT NULL,
-  uses_value BOOLEAN NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
-CREATE TABLE {prefix}amenity_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  amenity INT NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  amenity_value TINYTEXT NULL,
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}categories (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  parent INT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}category_member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  category INT NULL,
-  member_info INT NULL,
-  PRIMARY KEY (id),
-  CONSTRAINT {prefix}categories_fk_1
-    FOREIGN KEY (category)
-    REFERENCES {prefix}categories (id)
-    ON DELETE CASCADE,
-  INDEX(category),
-  INDEX(member_info)
-);
-
-----
-
-CREATE TABLE {prefix}cities (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}contacts (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  fname TINYTEXT NULL,
-  lname TINYTEXT NULL,
-  contact_type INT NULL,
-  org TINYTEXT NULL,
-  addr1 TINYTEXT NULL,
-  addr2 TINYTEXT NULL,
-  city INT NULL,
-  state INT NULL,
-  country INT NULL,
-  zip TINYTEXT NULL,
-  lat FLOAT NULL,
-  lon FLOAT NULL,
-  url TINYTEXT NULL,
-  office_phone TINYTEXT NULL,
-  home_phone TINYTEXT NULL,
-  mobile_phone TINYTEXT NULL,
-  alt_phone TINYTEXT NULL,
-  fax TINYTEXT NULL,
-  email TINYTEXT NULL,
-  alt_email TINYTEXT NULL,
-  password TINYTEXT NULL,
-  permissions TINYTEXT NULL,
-  notes TEXT NULL,
-  create_time TIMESTAMP NULL,
-  modify_time TIMESTAMP NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(fname(20)),
-  INDEX(lname(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(email(20))
-);
-
-----
-
-CREATE TABLE {prefix}facilities (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  facility_type INT NULL,
-  location INT NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  addr1 TINYTEXT NULL,
-  addr2 TINYTEXT NULL,
-  city INT NULL,
-  state INT NULL,
-  country INT NULL,
-  zip TINYTEXT NULL,
-  lat FLOAT NULL,
-  lon FLOAT NULL,
-  phone TINYTEXT NULL,
-  toll_free TINYTEXT NULL,
-  url TINYTEXT NULL,
-  logo TINYTEXT NULL,
-  notes TEXT NULL,
-  create_time TIMESTAMP NULL,
-  modify_time TIMESTAMP NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon)
-);
-
-----
-
-CREATE TABLE {prefix}files (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  file_name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  size INT NULL,
-  pending TINYINT(1) NULL,
-  create_date DATE NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}golf (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  rating TINYTEXT NULL,
-  par TINYTEXT NULL,
-  yardage TINYTEXT NULL,
-  slope TINYTEXT NULL,
-  walking TINYINT(1) NULL,
-  holes INT NULL,
-  reservation_url TINYTEXT NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}images (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  status TINYINT(1) NULL,
-  file_name TINYTEXT NULL,
-  descr TEXT NULL,
-  caption TINYTEXT NULL,
-  position INT NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(file_name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}locations (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  location_type INT NULL,
-  member INT NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  addr1 TINYTEXT NULL,
-  addr2 TINYTEXT NULL,
-  city INT NULL,
-  state INT NULL,
-  country INT NULL,
-  zip TINYTEXT NULL,
-  lat FLOAT NULL,
-  lon FLOAT NULL,
-  region INT NULL,
-  phone TINYTEXT NULL,
-  toll_free TINYTEXT NULL,
-  url TINYTEXT NULL,
-  logo TINYTEXT NULL,
-  notes TEXT NULL,
-  create_time TIMESTAMP NULL,
-  modify_time TIMESTAMP NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region)
-);
-
-----
-
-CREATE TABLE {prefix}meals (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  menu TEXT NULL,
-  special_menu TEXT NULL,
-  daily_time TINYINT(1) NULL,
-  daily_start_time TIME NULL,
-  daily_end_time TIME NULL,
-  daily_res_req TINYINT(1) NULL,
-  sunday TINYINT(1) NULL,
-  sun_menu TEXT NULL,
-  sun_start_time TIME NULL,
-  sun_end_time TIME NULL,
-  sun_res_req TINYINT(1) NULL,
-  monday TINYINT(1) NULL,
-  mon_menu TEXT NULL,
-  mon_start_time TIME NULL,
-  mon_end_time TIME NULL,
-  mon_res_req TINYINT(1) NULL,
-  tuesday TINYINT(1) NULL,
-  tue_menu TEXT NULL,
-  tue_start_time TIME NULL,
-  tue_end_time TIME NULL,
-  tue_res_req TINYINT(1) NULL,
-  wednesday TINYINT(1) NULL,
-  wed_menu TEXT NULL,
-  wed_start_time TIME NULL,
-  wed_end_time TIME NULL,
-  wed_res_req TINYINT(1) NULL,
-  thursday TINYINT(1) NULL,
-  thu_menu TEXT NULL,
-  thu_start_time TIME NULL,
-  thu_end_time TIME NULL,
-  thu_res_req TINYINT(1) NULL,
-  friday TINYINT(1) NULL,
-  fri_menu TEXT NULL,
-  fri_start_time TIME NULL,
-  fri_end_time TIME NULL,
-  fri_res_req TINYINT(1) NULL,
-  saturday TINYINT(1) NULL,
-  sat_menu TEXT NULL,
-  sat_start_time TIME NULL,
-  sat_end_time TIME NULL,
-  sat_res_req TINYINT(1) NULL,
-  restaurant INT NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
-CREATE TABLE {prefix}members (
-  id INT NOT NULL AUTO_INCREMENT,
-  access INT NULL,
-  member_type INT NULL,
-  created DATE NULL,
-  name TINYTEXT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20)),
-  INDEX(created)
-);
-
-----
-
-CREATE TABLE {prefix}member_info (
-  id INT NOT NULL AUTO_INCREMENT,
-  member INT NULL,
-  member_name TINYTEXT NULL,
-  member_slug TINYTEXT NULL,
-  status INT NULL,
-  reference_name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  addr1 TINYTEXT NULL,
-  addr2 TINYTEXT NULL,
-  city INT NULL,
-  state TINYTEXT NULL,
-  country TINYTEXT NULL,
-  zip TINYTEXT NULL,
-  lat FLOAT NULL,
-  lon FLOAT NULL,
-  region INT NULL,
-  phone TINYTEXT NULL,
-  toll_free TINYTEXT NULL,
-  url TINYTEXT NULL,
-  email TINYTEXT NULL,
-  logo TINYTEXT NULL,
-  cc_type INT NULL,
-  notes TEXT NULL,
-  create_time TIMESTAMP NULL,
-  modify_time TIMESTAMP NULL,
-  PRIMARY KEY (id),
-  INDEX(status),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(region)
-);
-
-----
-
-CREATE TABLE {prefix}member_type (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  descr TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}regions (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}restaurant_types (
-  id INT NOT NULL AUTO_INCREMENT,
-  active TINYINT(1) NULL,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  PRIMARY KEY (id),
-  INDEX(name(20))
-);
-
-----
-
-CREATE TABLE {prefix}restaurants (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,
-  name TINYTEXT NULL,
-  restaurant_type INT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  menu TEXT NULL,
-  special_menu TEXT NULL,
-  url TINYTEXT NULL,
-  reservation_url TINYTEXT NULL,
-  phone TINYTEXT NULL,
-  hours_descr TINYTEXT NULL,
-  alcohol TINYINT(1) NULL,
-  non_smoking TINYINT(1) NULL,
-  notes TEXT NULL,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  PRIMARY KEY (id),
-  INDEX(restaurant_type),
-  INDEX(name(20)),
-  INDEX(ref_type),
-  INDEX(ref_dest)
-);
-
-----
-
-CREATE TABLE {prefix}settings_general (
-  id INT NOT NULL AUTO_INCREMENT,
-  admin_debug BOOLEAN DEFAULT true,
-  admin_debug_verbose BOOLEAN DEFAULT false,
-  front_debug BOOLEAN DEFAULT false,
-  front_debug_verbose BOOLEAN DEFAULT false,
-  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 NULL,
-  canonical_member_page TINYTEXT NULL;
-  list_show_map BOOLEAN DEFAULT true,
-  list_show_list BOOLEAN DEFAULT true,
-  list_show_search BOOLEAN DEFAULT true,
-  list_show_search_text BOOLEAN DEFAULT true,
-  list_show_search_category BOOLEAN DEFAULT true,
-  list_show_search_amenities BOOLEAN DEFAULT true,
-  list_show_search_alpha BOOLEAN DEFAULT true,
-  list_show_detail_link BOOLEAN DEFAULT true,
-  list_show_logo BOOLEAN DEFAULT true,
-  list_logo_size TINYTEXT NULL,
-  list_show_address BOOLEAN DEFAULT true,
-  list_show_street BOOLEAN DEFAULT true,
-  list_show_citystatezip BOOLEAN DEFAULT true,
-  list_show_country BOOLEAN DEFAULT true,
-  list_show_region BOOLEAN DEFAULT true,
-  list_show_descr BOOLEAN DEFAULT false,
-  list_show_short_descr BOOLEAN DEFAULT true,
-  list_show_phone BOOLEAN DEFAULT true,
-  list_show_tollfree BOOLEAN DEFAULT true,
-  list_show_url BOOLEAN DEFAULT true,
-  list_show_url_newtarget BOOLEAN DEFAULT true,
-  list_show_email BOOLEAN DEFAULT true,
-  list_show_categories BOOLEAN DEFAULT true,
-  list_show_creditcards BOOLEAN DEFAULT true,
-  list_show_amenities BOOLEAN DEFAULT false,
-  list_map_show_detaillink BOOLEAN DEFAULT true,
-  list_map_show_logo BOOLEAN DEFAULT false,
-  list_map_logo_size TINYTEXT NULL,
-  list_map_show_descr BOOLEAN DEFAULT false,
-  list_map_show_short_descr BOOLEAN DEFAULT true,
-  list_map_show_address BOOLEAN DEFAULT true,
-  list_map_show_street BOOLEAN DEFAULT true,
-  list_map_show_citystatezip BOOLEAN DEFAULT true,
-  list_map_show_country BOOLEAN DEFAULT true,
-  list_map_show_region BOOLEAN DEFAULT true,
-  list_map_show_phone BOOLEAN DEFAULT true,
-  list_map_show_tollfree BOOLEAN DEFAULT true,
-  list_map_show_url BOOLEAN DEFAULT true,
-  list_map_show_url_newtarget BOOLEAN DEFAULT true,
-  list_map_show_email BOOLEAN DEFAULT true,
-  list_map_show_categories BOOLEAN DEFAULT false,
-  list_map_show_creditcards BOOLEAN DEFAULT false,
-  list_map_show_amenities BOOLEAN DEFAULT false,
-  detail_show_map BOOLEAN DEFAULT true,
-  detail_show_directions BOOLEAN DEFAULT true,
-  detail_show_logo BOOLEAN DEFAULT true,
-  detail_logo_size TINYTEXT NULL,
-  detail_show_descr BOOLEAN DEFAULT true,
-  detail_show_short_descr BOOLEAN DEFAULT false,
-  detail_show_address BOOLEAN DEFAULT true,
-  detail_show_street BOOLEAN DEFAULT true,
-  detail_show_citystatezip BOOLEAN DEFAULT true,
-  detail_show_country BOOLEAN DEFAULT true,
-  detail_show_region BOOLEAN DEFAULT true,
-  detail_show_phone BOOLEAN DEFAULT true,
-  detail_show_tollfree BOOLEAN DEFAULT true,
-  detail_show_url BOOLEAN DEFAULT true,
-  detail_show_url_newtarget BOOLEAN DEFAULT true,
-  detail_show_email BOOLEAN DEFAULT true,
-  detail_show_categories BOOLEAN DEFAULT true,
-  detail_show_creditcards BOOLEAN DEFAULT true,
-  detail_show_amenities BOOLEAN DEFAULT true,
-  detail_show_imagegallery BOOLEAN DEFAULT true,
-  detail_show_coupons BOOLEAN DEFAULT false,
-  detail_show_packages BOOLEAN DEFAULT false,
-  detail_map_show_logo BOOLEAN DEFAULT false,
-  detail_map_logo_size TINYTEXT NULL,
-  detail_map_show_descr BOOLEAN DEFAULT false,
-  detail_map_show_short_descr BOOLEAN DEFAULT true,
-  detail_map_show_address BOOLEAN DEFAULT true,
-  detail_map_show_street BOOLEAN DEFAULT true,
-  detail_map_show_citystatezip BOOLEAN DEFAULT true,
-  detail_map_show_country BOOLEAN DEFAULT true,
-  detail_map_show_region BOOLEAN DEFAULT true,
-  detail_map_show_phone BOOLEAN DEFAULT true,
-  detail_map_show_tollfree BOOLEAN DEFAULT true,
-  detail_map_show_url BOOLEAN DEFAULT true,
-  detail_map_show_url_newtarget BOOLEAN DEFAULT true,
-  detail_map_show_email BOOLEAN DEFAULT true,
-  detail_map_show_categories BOOLEAN DEFAULT false,
-  detail_map_show_creditcards BOOLEAN DEFAULT false,
-  detail_map_show_amenities BOOLEAN DEFAULT false,
-  PRIMARY KEY (id)
-);
-
-----
-
-INSERT INTO {prefix}settings_general
-    ( id, time_zone, canonical_member_page )
-   VALUES
-    ( 1, 'America/Detroit', 'member-detail' )
-;
-
-----
-
-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_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_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,
-  PRIMARY KEY (id)
-);
-
-----
-
-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_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_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                           
-    )
-   VALUES
-    (
-    1,
-    'Members',            
-    'Member',             
-    'Add Member',         
-    'Configure',          
-    'Management',           
-    'Shortcodes',         
-    'Dashboard',          
-    'Member List',        
-    'Reports',            
-    'Member Dashboard',
-    'Member Info',        
-    'Locations',          
-    'Facilities',         
-    'Attractions',        
-    'Contacts',           
-    'Member Types',       
-    'Member Categories',  
-    'Accommodation Types',
-    'Amenities',          
-    'Cities',             
-    'Regions',            
-    'General Settings',   
-    'Terms & Phrases',    
-    'Development',        
-    'member',             
-    'Member',             
-    'members',            
-    'Members',            
-    'location',           
-    'Location',           
-    'locations',          
-    'Locations',          
-    'facility',           
-    'Facility',           
-    'facilities',         
-    'Facilities',         
-    'attraction',         
-    'Attraction',         
-    'attractions',        
-    'Attractions',        
-    'contact',            
-    'Contact',            
-    'contacts',           
-    'Contacts'
-    )
-;
-
-----
-
-CREATE TABLE {prefix}social_media (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  descr TEXT NULL,
-  short_descr TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}social_media_ref (
-  id INT NOT NULL AUTO_INCREMENT,
-  ref_type INT NULL,
-  ref_dest INT NULL,
-  social_media INT NULL,
-  url TINYTEXT NULL,
-  PRIMARY KEY (id),
-  INDEX(ref_type),
-  INDEX(ref_dest),
-  INDEX(social_media)
-);
diff --git a/misc/databaseScripts/create_database_V1.0.30.sql b/misc/databaseScripts/create_database_V1.0.30.sql
new file mode 100644 (file)
index 0000000..c9e5964
--- /dev/null
@@ -0,0 +1,757 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.1 
+-- Database Creation Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+
+CREATE TABLE {prefix}accommodation_types (
+  id INT NOT NULL AUTO_INCREMENT,
+  facility_type INT NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  PRIMARY KEY (id),
+  INDEX(facility_type),
+  INDEX(name(20))
+);
+
+----
+
+CREATE TABLE {prefix}accommodations (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  name TINYTEXT NULL,
+  accommodation_type INT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  quant INT NULL,
+  reservation_url TINYTEXT NULL,
+  reservation_id TINYTEXT NULL,
+  year_round TINYINT(1) NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(accommodation_type),
+  INDEX(name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}accounts (
+  id INT NOT NULL AUTO_INCREMENT,
+  member INT NULL,
+  payment_type INT NULL,
+  invoice_delivery INT NULL,
+  PRIMARY KEY (id),
+  INDEX(member)
+);
+
+----
+
+CREATE TABLE {prefix}activties (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  activity_type INT NULL,
+  facility INT NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  phone TINYTEXT NULL,
+  url TINYTEXT NULL,
+  notes TEXT NULL,
+  create_time TIMESTAMP NULL,
+  modify_time TIMESTAMP NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(activity_type),
+  INDEX(name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}amenities (
+  id INT NOT NULL AUTO_INCREMENT,
+  active TINYINT(1) NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  ref_type INT NULL,
+  uses_value BOOLEAN NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+CREATE TABLE {prefix}amenity_ref (
+  id INT NOT NULL AUTO_INCREMENT,
+  amenity INT NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  amenity_value TINYTEXT NULL,
+  PRIMARY KEY (id),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}categories (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  parent INT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}category_member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  category INT NULL,
+  member_info INT NULL,
+  PRIMARY KEY (id),
+  CONSTRAINT {prefix}categories_fk_1
+    FOREIGN KEY (category)
+    REFERENCES {prefix}categories (id)
+    ON DELETE CASCADE,
+  INDEX(category),
+  INDEX(member_info)
+);
+
+----
+
+CREATE TABLE {prefix}cities (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}contacts (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  fname TINYTEXT NULL,
+  lname TINYTEXT NULL,
+  contact_type INT NULL,
+  org TINYTEXT NULL,
+  addr1 TINYTEXT NULL,
+  addr2 TINYTEXT NULL,
+  city INT NULL,
+  state INT NULL,
+  country INT NULL,
+  zip TINYTEXT NULL,
+  lat FLOAT NULL,
+  lon FLOAT NULL,
+  url TINYTEXT NULL,
+  office_phone TINYTEXT NULL,
+  home_phone TINYTEXT NULL,
+  mobile_phone TINYTEXT NULL,
+  alt_phone TINYTEXT NULL,
+  fax TINYTEXT NULL,
+  email TINYTEXT NULL,
+  alt_email TINYTEXT NULL,
+  password TINYTEXT NULL,
+  permissions TINYTEXT NULL,
+  notes TEXT NULL,
+  create_time TIMESTAMP NULL,
+  modify_time TIMESTAMP NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(fname(20)),
+  INDEX(lname(20)),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(email(20))
+);
+
+----
+
+CREATE TABLE {prefix}facilities (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  facility_type INT NULL,
+  location INT NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  addr1 TINYTEXT NULL,
+  addr2 TINYTEXT NULL,
+  city INT NULL,
+  state INT NULL,
+  country INT NULL,
+  zip TINYTEXT NULL,
+  lat FLOAT NULL,
+  lon FLOAT NULL,
+  phone TINYTEXT NULL,
+  toll_free TINYTEXT NULL,
+  url TINYTEXT NULL,
+  logo TINYTEXT NULL,
+  notes TEXT NULL,
+  create_time TIMESTAMP NULL,
+  modify_time TIMESTAMP NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon)
+);
+
+----
+
+CREATE TABLE {prefix}files (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  file_name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  size INT NULL,
+  pending TINYINT(1) NULL,
+  create_date DATE NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}golf (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  rating TINYTEXT NULL,
+  par TINYTEXT NULL,
+  yardage TINYTEXT NULL,
+  slope TINYTEXT NULL,
+  walking TINYINT(1) NULL,
+  holes INT NULL,
+  reservation_url TINYTEXT NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}images (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  status TINYINT(1) NULL,
+  file_name TINYTEXT NULL,
+  descr TEXT NULL,
+  caption TINYTEXT NULL,
+  position INT NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(file_name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}locations (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  location_type INT NULL,
+  member INT NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  addr1 TINYTEXT NULL,
+  addr2 TINYTEXT NULL,
+  city INT NULL,
+  state INT NULL,
+  country INT NULL,
+  zip TINYTEXT NULL,
+  lat FLOAT NULL,
+  lon FLOAT NULL,
+  region INT NULL,
+  phone TINYTEXT NULL,
+  toll_free TINYTEXT NULL,
+  url TINYTEXT NULL,
+  logo TINYTEXT NULL,
+  notes TEXT NULL,
+  create_time TIMESTAMP NULL,
+  modify_time TIMESTAMP NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(region)
+);
+
+----
+
+CREATE TABLE {prefix}meals (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  menu TEXT NULL,
+  special_menu TEXT NULL,
+  daily_time TINYINT(1) NULL,
+  daily_start_time TIME NULL,
+  daily_end_time TIME NULL,
+  daily_res_req TINYINT(1) NULL,
+  sunday TINYINT(1) NULL,
+  sun_menu TEXT NULL,
+  sun_start_time TIME NULL,
+  sun_end_time TIME NULL,
+  sun_res_req TINYINT(1) NULL,
+  monday TINYINT(1) NULL,
+  mon_menu TEXT NULL,
+  mon_start_time TIME NULL,
+  mon_end_time TIME NULL,
+  mon_res_req TINYINT(1) NULL,
+  tuesday TINYINT(1) NULL,
+  tue_menu TEXT NULL,
+  tue_start_time TIME NULL,
+  tue_end_time TIME NULL,
+  tue_res_req TINYINT(1) NULL,
+  wednesday TINYINT(1) NULL,
+  wed_menu TEXT NULL,
+  wed_start_time TIME NULL,
+  wed_end_time TIME NULL,
+  wed_res_req TINYINT(1) NULL,
+  thursday TINYINT(1) NULL,
+  thu_menu TEXT NULL,
+  thu_start_time TIME NULL,
+  thu_end_time TIME NULL,
+  thu_res_req TINYINT(1) NULL,
+  friday TINYINT(1) NULL,
+  fri_menu TEXT NULL,
+  fri_start_time TIME NULL,
+  fri_end_time TIME NULL,
+  fri_res_req TINYINT(1) NULL,
+  saturday TINYINT(1) NULL,
+  sat_menu TEXT NULL,
+  sat_start_time TIME NULL,
+  sat_end_time TIME NULL,
+  sat_res_req TINYINT(1) NULL,
+  restaurant INT NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+CREATE TABLE {prefix}members (
+  id INT NOT NULL AUTO_INCREMENT,
+  access INT NULL,
+  member_type INT NULL,
+  created DATE NULL,
+  name TINYTEXT NULL,
+  member_slug TINYTEXT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20)),
+  INDEX(member_slug(20)),
+  INDEX(created)
+);
+
+----
+
+CREATE TABLE {prefix}member_info (
+  id INT NOT NULL AUTO_INCREMENT,
+  member INT NULL,
+  member_name TINYTEXT NULL,
+  status INT NULL,
+  reference_name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TEXT NULL,
+  addr1 TINYTEXT NULL,
+  addr2 TINYTEXT NULL,
+  city INT NULL,
+  state TINYTEXT NULL,
+  country TINYTEXT NULL,
+  zip TINYTEXT NULL,
+  lat FLOAT NULL,
+  lon FLOAT NULL,
+  region INT NULL,
+  phone TINYTEXT NULL,
+  toll_free TINYTEXT NULL,
+  url TINYTEXT NULL,
+  email TINYTEXT NULL,
+  logo TINYTEXT NULL,
+  cc_type INT NULL,
+  notes TEXT NULL,
+  create_time TIMESTAMP NULL,
+  modify_time TIMESTAMP NULL,
+  PRIMARY KEY (id),
+  INDEX(status),
+  INDEX(city),
+  INDEX(zip(10)),
+  INDEX(lat),
+  INDEX(lon),
+  INDEX(region)
+);
+
+----
+
+CREATE TABLE {prefix}member_type (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  descr TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}regions (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}restaurant_types (
+  id INT NOT NULL AUTO_INCREMENT,
+  active TINYINT(1) NULL,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  PRIMARY KEY (id),
+  INDEX(name(20))
+);
+
+----
+
+CREATE TABLE {prefix}restaurants (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,
+  name TINYTEXT NULL,
+  restaurant_type INT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  menu TEXT NULL,
+  special_menu TEXT NULL,
+  url TINYTEXT NULL,
+  reservation_url TINYTEXT NULL,
+  phone TINYTEXT NULL,
+  hours_descr TINYTEXT NULL,
+  alcohol TINYINT(1) NULL,
+  non_smoking TINYINT(1) NULL,
+  notes TEXT NULL,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  PRIMARY KEY (id),
+  INDEX(restaurant_type),
+  INDEX(name(20)),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+CREATE TABLE {prefix}settings_general (
+  id INT NOT NULL AUTO_INCREMENT,
+  admin_debug BOOLEAN DEFAULT '1',
+  admin_debug_verbose BOOLEAN DEFAULT '0',
+  front_debug BOOLEAN DEFAULT '0',
+  front_debug_verbose BOOLEAN DEFAULT '0',
+  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,
+  list_show_map BOOLEAN DEFAULT '1',
+  list_show_list BOOLEAN DEFAULT '1',
+  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_alpha BOOLEAN DEFAULT '1',
+  list_show_detail_link BOOLEAN DEFAULT '1',
+  list_show_logo BOOLEAN DEFAULT '1',
+  list_logo_size TINYTEXT NULL,
+  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 '1',
+  list_show_creditcards BOOLEAN DEFAULT '1',
+  list_show_amenities 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',
+  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 '1',
+  detail_show_creditcards BOOLEAN DEFAULT '1',
+  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_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',
+  PRIMARY KEY (id)
+);
+
+----
+
+INSERT INTO {prefix}settings_general
+    ( id, time_zone, canonical_member_page )
+   VALUES
+    ( 1, 'America/Detroit', 'member-detail' )
+;
+
+----
+
+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_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_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,
+  PRIMARY KEY (id)
+);
+
+----
+
+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_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_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                           
+    )
+   VALUES
+    (
+    1,
+    'Members',            
+    'Member',             
+    'Add Member',         
+    'Configure',          
+    'Management',           
+    'Shortcodes',         
+    'Dashboard',          
+    'Member List',        
+    'Reports',            
+    'Member Dashboard',
+    'Member Info',        
+    'Locations',          
+    'Facilities',         
+    'Attractions',        
+    'Contacts',           
+    'Member Types',       
+    'Member Categories',  
+    'Accommodation Types',
+    'Amenities',          
+    'Cities',             
+    'Regions',            
+    'General Settings',   
+    'Terms & Phrases',    
+    'Development',        
+    'member',             
+    'Member',             
+    'members',            
+    'Members',            
+    'location',           
+    'Location',           
+    'locations',          
+    'Locations',          
+    'facility',           
+    'Facility',           
+    'facilities',         
+    'Facilities',         
+    'attraction',         
+    'Attraction',         
+    'attractions',        
+    'Attractions',        
+    'contact',            
+    'Contact',            
+    'contacts',           
+    'Contacts'
+    )
+;
+
+----
+
+CREATE TABLE {prefix}social_media (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  descr TEXT NULL,
+  short_descr TINYTEXT NULL,
+  PRIMARY KEY (id)
+);
+
+----
+
+CREATE TABLE {prefix}social_media_ref (
+  id INT NOT NULL AUTO_INCREMENT,
+  ref_type INT NULL,
+  ref_dest INT NULL,
+  social_media INT NULL,
+  url TINYTEXT NULL,
+  PRIMARY KEY (id),
+  INDEX(ref_type),
+  INDEX(ref_dest),
+  INDEX(social_media)
+);
diff --git a/misc/databaseScripts/drop_database_V0.1.sql b/misc/databaseScripts/drop_database_V0.1.sql
deleted file mode 100644 (file)
index 2c792d8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.1 
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE
-    {prefix}accommodation_types,
-    {prefix}accommodations,
-    {prefix}accounts,
-    {prefix}activties,
-    {prefix}amenities,
-    {prefix}amenity_ref,
-    {prefix}category_member_info,
-    {prefix}categories,
-    {prefix}cities,
-    {prefix}contacts,
-    {prefix}facilities,
-    {prefix}files,
-    {prefix}golf,
-    {prefix}images,
-    {prefix}locations,
-    {prefix}meals,
-    {prefix}members,
-    {prefix}member_info,
-    {prefix}member_type,
-    {prefix}regions,
-    {prefix}restaurant_types,
-    {prefix}restaurants,
-    {prefix}settings_general,
-    {prefix}settings_terms,
-    {prefix}social_media,
-    {prefix}social_media_ref
-;
-
diff --git a/misc/databaseScripts/drop_database_V1.0.30.sql b/misc/databaseScripts/drop_database_V1.0.30.sql
new file mode 100644 (file)
index 0000000..2c792d8
--- /dev/null
@@ -0,0 +1,35 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.1 
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE
+    {prefix}accommodation_types,
+    {prefix}accommodations,
+    {prefix}accounts,
+    {prefix}activties,
+    {prefix}amenities,
+    {prefix}amenity_ref,
+    {prefix}category_member_info,
+    {prefix}categories,
+    {prefix}cities,
+    {prefix}contacts,
+    {prefix}facilities,
+    {prefix}files,
+    {prefix}golf,
+    {prefix}images,
+    {prefix}locations,
+    {prefix}meals,
+    {prefix}members,
+    {prefix}member_info,
+    {prefix}member_type,
+    {prefix}regions,
+    {prefix}restaurant_types,
+    {prefix}restaurants,
+    {prefix}settings_general,
+    {prefix}settings_terms,
+    {prefix}social_media,
+    {prefix}social_media_ref
+;
+
diff --git a/misc/databaseScripts/update_database_V1.0.30.php b/misc/databaseScripts/update_database_V1.0.30.php
new file mode 100644 (file)
index 0000000..8d4b896
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/*
+ * Gaslight Media Members Database
+ *
+ * Database Update Script for version 1.0.28
+ */
+
+// Update member_info records with member name slug for URLs
+$memberRecords = $this->wpdb->get_results('SELECT id, name FROM '.GLM_MEMBERS_PLUGIN_DB_PREFIX.'members;', ARRAY_A);
+if ($memberRecords && count($memberRecords) > 0) {
+    foreach ($memberRecords as $m) {
+        $slug = sanitize_title($m['name']);
+        $this->wpdb->update(
+                GLM_MEMBERS_PLUGIN_DB_PREFIX.'members',
+                array(
+                        'member_slug' => $slug
+                ),
+                array( 'id' => $m['id'] ),
+                array( '%s' ),
+                array( '%d')
+        );
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/misc/databaseScripts/update_database_V1.0.30.sql b/misc/databaseScripts/update_database_V1.0.30.sql
new file mode 100644 (file)
index 0000000..fde3551
--- /dev/null
@@ -0,0 +1,18 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.0.28
+-- 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 dashses
+
+ALTER TABLE {prefix}members ADD COLUMN member_slug TINYTEXT;
+
+----
+
+ALTER TABLE {prefix}member_info DROP COLUMN member_slug;
+
+----
+
+ALTER TABLE {prefix}member_info MODIFY short_descr TEXT;
+
index ee2b9bb..b718ac7 100644 (file)
@@ -308,6 +308,7 @@ class GlmMembersAdmin_management_development
 
         // Read in Database creation script
         $sqlFile = GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/create_database_V'.$dbVersion.'.sql';
+
         $sql = file_get_contents($sqlFile);
 
         // Replace {prefix} with table name prefix
index bd26995..dfc1178 100644 (file)
@@ -835,12 +835,14 @@ class GlmMembersAdmin_management_import
                                         'access' => $this->config['memb_access_numb']['Full'],
                                         'member_type' => $defaultMemberType,
                                         'created' => date('Y-m-d'),
-                                        'name' => $val['member_name']
+                                        'name' => $val['member_name'],
+                                        'member_slug' => sanitize_title($val['member_name']),
                                 ),
                                 array(
                                         '%d',
                                         '%d',
                                         '%s',
+                                        '%s',
                                         '%s'
                                 )
                         );
@@ -849,7 +851,8 @@ class GlmMembersAdmin_management_import
 
                         // Create truncated short_descr from descritions - Less tags, html encoded characters, newlines, tabs, etc.
                         $stripped = str_replace(PHP_EOL, '', preg_replace('/\t+/', '', preg_replace("/&#?[a-z0-9]{2,8};/i", "", strip_tags($val['description']))));
-                        $short_descr = implode(' ', array_slice(explode(' ', $stripped), 0, 190));
+                        $short_descr = implode(' ', array_slice(explode(' ', $stripped), 0, 30));
+
                         if (strlen($short_descr) < strlen($stripped)) {
                             $short_descr .= ' ...';
                         }
@@ -869,7 +872,6 @@ class GlmMembersAdmin_management_import
                                 array(
                                         'member' => $membID,
                                         'member_name' => $val['member_name'],
-                                        'member_slug' => sanitize_title($val['member_name']),
                                         'status' => $this->config['status_numb']['Active'],
                                         'reference_name' => 'Imported Member Information',
                                         'descr' => $val['description'],
@@ -896,7 +898,6 @@ class GlmMembersAdmin_management_import
                                 array(
                                         '%d',
                                         '%s',
-                                        '%s',
                                         '%d',
                                         '%s',
                                         '%s',
index 179f569..5db6856 100644 (file)
  * @version  0.1
  */
 
+// Translation table for [glm-member-detail] "show" options to configuration parameters
+$GLOBALS['showOpts'] = array(
+        'map' =>                    'detail_show_map',
+        'map-logo' =>               'detail_map_show_logo',
+        'map-description' =>        'detail_map_show_descr',
+        'map-short-description' =>  'detail_map_show_short_descr',
+        'map-address' =>            'detail_map_show_address',
+        'map-street' =>             'detail_map_show_street',
+        'map-city-state-zip' =>     'detail_map_show_citystatezip',
+        'map-country' =>            'detail_map_show_country',
+        'map-region' =>             'detail_map_show_region',
+        'map-phone' =>              'detail_map_show_phone',
+        'map-toll-free' =>          'detail_map_show_tollfree',
+        'map-url' =>                'detail_map_show_url',
+        'map-url-new-target' =>     'detail_map_show_url_newtarget',
+        'map-email' =>              'detail_map_show_email',
+        'map-categories' =>         'detail_map_show_categories',
+        'map-credit-cards' =>       'detail_map_show_creditcards',
+        'map-amentities' =>         'detail_map_show_amenities',
+        'logo' =>                   'detail_show_logo',
+        'address' =>                'detail_show_address',
+        'street' =>                    'detail_show_street',
+        'city-state-zip' =>         'detail_show_citystatezip',
+        'country' =>               'detail_show_country',
+        'region' =>                    'detail_show_region',
+        'description' =>            'detail_show_descr',
+        'short-description' =>     'detail_show_short_descr',
+        'phone' =>                  'detail_show_phone',
+        'toll-free' =>              'detail_show_tollfree',
+        'url' =>                    'detail_show_url',
+        'url-new-target' =>         'detail_show_url_newtarget',
+        'email' =>                  'detail_show_email',
+        'categories' =>                    'detail_show_categories',
+        'credit-cards' =>           'detail_show_creditcards',
+        'amentities' =>             'detail_show_amenities'
+);
+
 // Load Members data abstract
 require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
 
@@ -98,14 +135,88 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
      */
     public function modelAction ($actionData = false)
     {
-//echo "top of modelAction() in front/members/detail.php<pre>".print_r($_REQUEST,1).print_r($actionData,1)."</pre>";exit;
-//echo "<pre>".print_r($_GET,1)."</pre>";
+
         $where = '';
         $haveMember = false;
         $haveImageGallery = false;
 
-        // If member ID submitted in the URL
-        if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
+        // Check for "show" shortcode parameter
+        $settings = array();
+        $showList = $actionData['request']['show'];
+echo "$showList<br>";
+
+        if ($showList) {
+
+            // Separate options and see if we have any
+            $show = explode(',', $showList);
+            if (count($show) > 0) {
+
+                // For each option
+                foreach ($show as $s) {
+
+                    $s = trim($s);
+
+                    // If we're setting all
+                    if ($s == 'all') {
+
+                        while (list($key, $val) = each($GLOBALS['showOpts'])) {
+                            $settings[$val] = true;
+                        }
+
+                        // Or we're clearing all
+                    } elseif ($s == 'none') {
+echo "Here";
+                        while (list($key, $val) = each($GLOBALS['showOpts'])) {
+                            $settings[$val] = false;
+                        }
+
+                        // Or it's a single option
+                    } else {
+
+                        // Check if we're setting or clearing
+                        $tf = $s[0];
+                        if ($tf == '+') {
+                            $tf = true;
+                        } elseif ($tf == '-') {
+                            $tf = false;
+                        } else {
+                            $tf = null;
+                        }
+
+                        // If we have +/- and we have the key in our showOpts array
+                        $k = substr($s, 1);
+                        if ($tf !== null && isset($GLOBALS['showOpts'][$k])) {
+
+                            // Get the name of the configuration option
+                            $c = $GLOBALS['showOpts'][$k];
+
+                            // If the configuration option exists, add to list of modified settings
+                            if (isset($this->config['settings'][$c])) {
+                                $settings[$c] = $tf;
+                            }
+                        }
+
+                    }
+
+                }
+
+            }
+        }
+
+
+        // If we have a member slug supplied from a rewrite - get the id
+        $rrMemberSlug = get_query_var('memberslug', '');
+        if ($rrMemberSlug != '') {
+
+        $sql = "
+            SELECT id
+              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "members
+              WHERE member_slug = '$rrMemberSlug'
+           ;";
+        $id = $this->wpdb->get_var($sql);
+
+        // Otherwise if member ID submitted in the URL
+        } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
 
             $id = ($_REQUEST['id'] - 0);
 
@@ -175,7 +286,8 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
             'menuItemRedirect' => false,
             'modelRedirect' => false,
             'view' => 'front/members/detail.html',
-            'data' => $templateData
+            'data' => $templateData,
+            'settings' => $settings
         );
 
     }
index c99b060..92ec8e1 100644 (file)
  * @version  0.1
  */
 
+// Translation table for [glm-members-list] "show" options to configuration parameters
+$GLOBALS['showOpts'] = array(
+    'map' =>                    'list_show_map',
+    'map-name-link' =>          'list_map_show_detaillink',
+    'map-logo' =>               'list_map_show_logo',
+    'map-description' =>        'list_map_show_descr',
+    'map-short-description' =>  'list_map_show_short_descr',
+    'map-address' =>            'list_map_show_address',
+    'map-street' =>             'list_map_show_street',
+    'map-city-state-zip' =>     'list_map_show_citystatezip',
+    'map-country' =>            'list_map_show_country',
+    'map-region' =>             'list_map_show_region',
+    'map-phone' =>              'list_map_show_phone',
+    'map-toll-free' =>          'list_map_show_tollfree',
+    'map-url' =>                'list_map_show_url',
+    'map-url-new-target' =>     'list_map_show_url_newtarget',
+    'map-email' =>              'list_map_show_email',
+    'map-categories' =>         'list_map_show_categories',
+    'map-credit-cards' =>       'list_map_show_creditcards',
+    'map-amentities' =>         'list_map_show_amenities',
+    'search' =>                 'list_show_search',
+    'search-text' =>            'list_show_search_text',
+    'search-categories' =>      'list_show_search_category',
+    'search-amenities' =>       'list_show_search_amenities',
+    'search-alpha' =>           'list_show_search_alpha',
+    'list' =>                   'list_show_list',
+    'name-link' =>                 'list_show_detail_link',
+    'logo' =>                   'list_show_logo',
+    'address' =>                'list_show_address',
+    'street' =>                        'list_show_street',
+    'city-state-zip' =>         'list_show_citystatezip',
+    'country' =>                   'list_show_country',
+    'region' =>                        'list_show_region',
+    'description' =>            'list_show_descr',
+    'short-description' =>         'list_show_short_descr',
+    'phone' =>                  'list_show_phone',
+    'toll-free' =>              'list_show_tollfree',
+    'url' =>                    'list_show_url',
+    'url-new-target' =>         'list_show_url_newtarget',
+    'email' =>                  'list_show_email',
+    'categories' =>                'list_show_categroies',
+    'credit-cards' =>           'list_show_creditcards',
+    'amentities' =>             'list_show_amenities'
+);
+
 // Load Members data abstract
 require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
 
@@ -107,6 +152,68 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $haveFilter = false;
         $textSearch = '';
 
+        // Check for "show" shortcode parameter
+        $settings = array();
+        $showList = $actionData['request']['show'];
+
+        if ($showList) {
+
+            // Separate options and see if we have any
+            $show = explode(',', $showList);
+            if (count($show) > 0) {
+
+                // For each option
+                foreach ($show as $s) {
+
+                    $s = trim($s);
+
+                    // If we're setting all
+                    if ($s == 'all') {
+
+                        while (list($key, $val) = each($GLOBALS['showOpts'])) {
+                            $settings[$val] = true;
+                        }
+
+                    // Or we're clearing all
+                    } elseif ($s == 'none') {
+
+                        while (list($key, $val) = each($GLOBALS['showOpts'])) {
+                            $settings[$val] = false;
+                        }
+
+                    // Or it's a single option
+                    } else {
+
+                        // Check if we're setting or clearing
+                        $tf = $s[0];
+                        if ($tf == '+') {
+                            $tf = true;
+                        } elseif ($tf == '-') {
+                            $tf = false;
+                        } else {
+                            $tf = null;
+                        }
+
+                        // If we have +/- and we have the key in our showOpts array
+                        $k = substr($s, 1);
+                        if ($tf !== null && isset($GLOBALS['showOpts'][$k])) {
+
+                            // Get the name of the configuration option
+                            $c = $GLOBALS['showOpts'][$k];
+
+                            // If the configuration option exists, add to list of modified settings
+                            if (isset($this->config['settings'][$c])) {
+                                $settings[$c] = $tf;
+                            }
+                        }
+
+                    }
+
+                }
+
+            }
+        }
+
         // Apply any provided text search to name, description, short description, and street address
         if (isset($_REQUEST['textSearch']) && $_REQUEST['textSearch'] != '') {
             $textSearch = filter_input(INPUT_POST, 'textSearch', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
@@ -164,7 +271,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             $categoryData[$c[0]]['default'] = true;
 
         }
-        
+
 
         // Get amenity filter data
         $amenityData = false;
@@ -228,7 +335,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         /*
          *  Get a current list of members
          */
-        
+
         // Get member list and sort
         $list = $this->getList($where.$alphaWhere, 'member_name');
 
@@ -273,7 +380,8 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
             'menuItemRedirect' => false,
             'modelRedirect' => false,
             'view' => 'front/members/list.html',
-            'data' => $templateData
+            'data' => $templateData,
+            'settings' => $settings
         );
 
     }
index c957fb7..bf7d4ad 100644 (file)
                     {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
                 </td>
             </tr>
+            
+            
+            <tr>
+                <th {if $member.fieldRequired.member_slug}class="glm-required"{/if}>Name for URLs:</th>
+                <td {if $member.fieldFail.member_slug}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="member_slug" value="{$member.fieldData.member_slug}" class="glm-form-text-input" placeholder="Slug of member name used for URLs.">
+                    {if $member.fieldFail.member_slug}<p>{$member.fieldFail.member_slug}</p>{/if}
+                </td>
+            </tr>
+            
+            
             <tr>
                 <th {if $member.fieldRequired.access}class="glm-required"{/if}>Access:</th>
                 <td {if $member.fieldFail.access}class="glm-form-bad-input"{/if}>
index 92e8e64..c4eba6e 100644 (file)
                 <th>Member Name:</th>
                 <td>{$member.name}</td>
             </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.member_slug}class="glm-required"{/if}>Name for URLs:</th>
-                <td {if $memberInfo.fieldFail.member_slug}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="member_slug" value="{$memberInfo.fieldData.member_slug}" class="glm-form-text-input" placeholder="Slug of member name used for URLs.">
-                    {if $memberInfo.fieldFail.member_slug}<p>{$memberInfo.fieldFail.member_slug}</p>{/if}
-                </td>
-            </tr>
             <tr>
                 <th>Member Type:</th>
                 <td>{$member.member_type.name}</td>
index 0379c8c..b37fd3f 100644 (file)
     
     <table class="glm-admin-table">
         <tr><th>Shortcode</th><th>Attribute</th><th>Description</th></tr>
+        
+<!-- glm-members-list -->
+        
         <tr>
             <th>[glm-members-list]</th>
             <td>&nbsp;</td>
             <td width="50%">
+                <p>
                 Displays a list of members and a map with markers for each member. Optionally, 
                 the attributes below may used to modify the display of this page.
+                </p>
             </td>
         </tr>
         <tr>
                 category="{ category ID(s) }"
             </th>
             <td>
+                <p>
                 The "category" attribute is used display only members in a specific category or 
                 ctegories. To select multiple categories, separate the categories with a ",". 
                 Categories are specified by ID number. The ID for each category is 
-                shown in the Member Categories list. 
+                shown in the Member Categories list.
+                </p> 
             </td>
         </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <th>
+                show="{ content to show }"
+            </th>
+            <td>
+                <p>
+                The "show" attribute is used control what content should be displayed in the 
+                member list. The default is to show the content selected in the "Management",
+                "General Settings" page under "Member List Page Options".
+                </p> 
+                <p>
+                Content to show or not show is specified by a comma separated list of the 
+                items listed below. Each item must be preceeded by either a "+" or a "-" to
+                indecate whether the that content should or should not be shown. 
+                </p>
+                <p>
+                There are two special items "all" and "none". These should not have a "+" or 
+                "-" in front of them and should be the first item in the comma separated
+                list. These can be used to turn all content on or turn all content off. Any
+                items listed after this will add or remove those items from being displayed.  
+                </p>
+                <p>
+                The only content that may not be dissabled is the member name. This will always
+                show regardless of any settings, although there is a setting to show this as a
+                link or not as a link.
+                </p>
+                <p>
+                    <table width="100%">
+                        <tr><th colspan=3">Global Options</th></tr>
+                        <tr><td>all</td><td>none</td></tr>
+                        <tr><th colspan=3">Map Options</th></tr>
+                        <tr><td>map</td><td>map-name-link</td><td>map-logo</td></tr>
+                        <tr><td>map-description</td><td>map-short-description</td><td>map-address</td></tr>
+                        <tr><td>map-street</td><td>map-city-state-zip</td><td>map-country</td></tr>
+                        <tr><td>map-region</td><td>map-phone</td><td>map-toll-free</td></tr>
+                        <tr><td>map-url</td><td>map-url-new-target</td><td>map-email</td></tr>
+                        <tr><td>map-categories</td><td>map-credit-cards</td><td>map-amentities</td></tr>
+                        <tr><th colspan=3">Search Form Options</th></tr>
+                        <tr><td>search</td><td>search-text</td><td>search-categories</td></tr>
+                        <tr><td>search-amenities</td><td>search-alpha</td></tr>
+                        <tr><th colspan=3">Member List Options</th></tr>
+                        <tr><td>list</td><td>name-link</td><td>logo</td></tr>
+                        <tr><td>address</td><td>street</td><td>city-state-zip</td></tr>
+                        <tr><td>country</td><td>region</td><td>description</td></tr>
+                        <tr><td>short-description</td><td>phone</td><td>toll-free</td></tr>
+                        <tr><td>url</td><td>url-new-target</td><td>email</td></tr>
+                        <tr><td>categories</td><td>credit-cards</td><td>amentities</td></tr>
+                    </table>
+                </p>
+            </td>
+        </tr>
+        
+<!-- glm-member-detail -->
+        
         <tr>
             <th>[glm-member-detail]</th>
             <td>&nbsp;</td>
             <td>
+                <p>
                 Displays details for a speicif member along with a map showing their location. The 
-                "id" attribute below is required to specify which member to display. 
+                "id" attribute below is required to specify which member to display.
+                </p> 
             </td>
         </tr>
          <tr>
                 id="{ member ID }"
             </th>
             <td>
+                <p>
                 This is an optional attribute for [glm-member-detail] that specifies the ID of
                 the desired member. The ID for a member is displayed both in the left column
                 of the member list and at the top of the Member Dashboard. Only one ID may
                 member name slug as the last part of the path in the URL and try to locate
                 an active member information record with "Name for URLs" set to the same
                 string.
-                
+                </p>
+            </td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <th>
+                show="{ content to show }"
+            </th>
+            <td>
+                <p>
+                The "show" attribute is used control what content should be displayed in 
+                member detail. The default is to show the content selected in the "Management",
+                "General Settings" page under "Member Detail Page Options".
+                </p> 
+                <p>
+                Content to show or not show is specified by a comma separated list of the 
+                items listed below. Each item must be preceeded by either a "+" or a "-" to
+                indecate whether the that content should or should not be shown. 
+                </p>
+                <p>
+                There are two special items "all" and "none". These should not have a "+" or 
+                "-" in front of them and should be the first item in the comma separated
+                list. These can be used to turn all content on or turn all content off. Any
+                items listed after this will add or remove those items from being displayed.  
+                </p>
+                <p>
+                The only content that may not be dissabled is the member name. This will always
+                show regardless of any settings, although there is a setting to show this as a
+                link or not as a link.
+                </p>
+                <p>
+                    <table width="100%">
+                        <tr><th colspan=3">Global Options</th></tr>
+                        <tr><td>all</td><td>none</td></tr>
+                        <tr><th colspan=3">Map Options</th></tr>
+                        <tr><td>map</td><td>map-logo</td><td>map-description</td></tr>
+                        <tr><td>map-short-description</td><td>map-address</td><td>map-street</td></tr>
+                        <tr><td>map-city-state-zip</td><td>map-country</td><td>map-region</td></tr>
+                        <tr><td>map-phone</td><td>map-toll-free</td><td>map-url</td></tr>
+                        <tr><td>map-url-new-target</td><td>map-email</td><td>map-categories</td></tr>
+                        <tr><td>map-credit-cards</td><td>map-amentities</td></tr>
+                        <tr><th colspan=3">Directions Options</th></tr>
+                        <tr><td>directions</td></tr>
+                        <tr><th colspan=3">Member Detail Options</th></tr>
+                        <tr><td>logo</td><td>address</td><td>street</td></tr>
+                        <tr><td>city-state-zip</td><td>country</td><td>region</td></tr>
+                        <tr><td>description</td><td>short-description</td><td>phone</td></tr>
+                        <tr><td>toll-free</td><td>url</td><td>url-new-target</td></tr>
+                        <tr><td>email</td><td>categories</td><td>credit-cards</td></tr>
+                        <tr><td>amentities</td></tr>
+                    </table>
+                </p>
             </td>
         </tr>
     </table>