From: Chuck Scott There is missing database information for plugin/add-on '.$a['name']."."
+ ." Failure installing database tables for the '.$a['name']
+ .' New database tables installed for the '.$a['name'].' plugin. Failure installing database tables for the '.$a['name']
+ .' Failure installing database tables for the '.$a['name']
- .'
Incorrect plugin/add-on configuration is suspected. Check add-on registration data array for this add-on.
No database version set:
Database Creation Script not found: '.$sqlFile.'
Database Installation Error: '.print_r($queryError,1)
- .''.$q.'
New database tables installed for the '.$a['name'].' plugin.
'; + + // Save the version of the installed database + update_option($a['database']['dbActiveVersionOption'], $dbVersion); + + // Indicate that we were successfull + $db_setup_status = true; + + } else { + $startupNotices .= 'Failure installing database tables for the '.$a['name']
+ .'
Database Installation Error: '.print_r($queryError,1)
+ .'
'.$q.''; + } + + } // db creation file check + + } // db version check // Otherwise, check if we need to update the database } elseif ($dbVersion != $a['database']['dbCurrentVersion']) { diff --git a/controllers/admin.php b/controllers/admin.php index f1496584..fab3f2c4 100644 --- a/controllers/admin.php +++ b/controllers/admin.php @@ -696,7 +696,11 @@ class glmMembersAdmin extends GlmPluginSupport do { if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action", 'Process'); + $option = ''; + if (isset($_REQUEST['option'])) { + $option = ', Option = '.$_REQUEST['option']; + } + $this->addNotice("Requested Action: Menu item = $menuItem, Action = $action".$option, 'Process'); } $modelRedirect = false; diff --git a/css/admin.css b/css/admin.css index 99a94723..5c3d988b 100644 --- a/css/admin.css +++ b/css/admin.css @@ -41,6 +41,9 @@ .glm-clear { clear: both; } +.glm-nowrap { + white-space: nowrap; +} .glm-hidden { display: none !important; } diff --git a/glm-member-db.php b/glm-member-db.php deleted file mode 100644 index 704dab0d..00000000 --- a/glm-member-db.php +++ /dev/null @@ -1,441 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.0.47 - */ - -/* - * Plugin and Database Versions - * - * Database updates for the main plugin and add-ons must also be - * listed in the /setup/databaseScripts/dbVersions.php file of - * the corresponding plugin/add-on. The table in that file - * determines which version is installed for a new activation - * and which update scrips are run to bring the database up to - * the current version. - * - * We check the plugin version stored in the WordPress option below - * so that we're sure the other add-ons see an up to date - * version from this plugin. - * - */ - -define('GLM_MEMBERS_PLUGIN_VERSION', '1.0.58'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.2'); - -// Check if plugin version is not current in WordPress option and if needed updated it -if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { - update_option('glmMembersDatabasePluginVersion', GLM_MEMBERS_PLUGIN_VERSION); -} - -/* - * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * ******************************************************************************* - * - * *** Directory and File Structure *** - * - * index.php - * - * Index file for this plugin. All plugin processing starts here. (See - * "Process Flow" below.) - * - * controllers - * - * Directory containing any controllers. Typically there - * would be admin and front controllers in this directory. - * These controllers do the general setup for the plugin, - * determine and call the appropriate model, determine the - * appropriate view, then merge any data returned by the model - * with the view and output the result as appropriate. - * - * When executed, a model may determine that it cannot handle - * the current request and return such a notice to the controller - * possibly with a suggested model to execute. Models may also - * return a desired view back to the controller based on the - * result of processing, but should do so in a generic way so - * as to permit multi-lingual output and use of multiple "skins" - * (but not to the exception of appropriate use of WordPress - * Themes). - * - * css - * - * Directory containing any css files specific to this plugin. - * The use of additional styling should be kept to a minimum - * so as to not interfere with the application of WordPress - * default styling and Themes. - * - * js - * - * Directory containing any JAVAscript files specific to this - * Plugin. This directory should be reserved for general script - * files that provide functionality that can be used in various - * views. Any JAVAscript that is specific to a view should be - * located along with the associated view as it is logically - * part of the view. - * - * lib - * - * Directory containing any class or function libraries that - * are used generally by this plugin. Any class or other code - * that is specific to a particular model should be located - * in, or along with, that model since it is logically - * associated only with that model. - * - * misc - * - * Directory containing ancillary directories and files. This - * might be used for things like cach directories. An example - * might be the "smarty" directory for Smaarty Templates. - * - * models - * - * Directory containing model files that execute a specific - * process in this plugin. If this is a simple plugin, then - * the model files can be placed directly in this directory. - * If it's a more complex plugin, then there should be sub- - * directories for various groupings of related model files. - * - * An individual model may consist of a grouping of files, - * such as additional class files, that are specific only to - * that model. In that case, these should be located in a - * subdirectory under where the model file called by the - * controller is located and that directory should be named - * so as to be obviously associated with that model. - * - * There are three special files in the models directory. These - * are activate.php, deactivate.php, and uninstall.php. These - * are called via hooks setup in this file and should always - * be here. If they do not provide any real functionality, they - * should at least be a shell that can be called for those - * situations. - * - * views - * - * Directory containing view files for producing output upon - * request of a model file in the models directory. If this - * is a simply plugin, then the view files can be placed - * directly in this directory. If it's a more complex plugin, - * then there should be sub-directories for the various - * groupings of related view files. If using sub-directories, - * those should generally match the associated model directories. - * It may also be wise to use separate front and admin - * directories under views to keep things organized. - * - * Additionally, views may be grouped in such a way that they - * support the selection of various "skins" that output in - * different ways, although any styling should be provided by - * WordPress Themes or use default WordPress styling. - * - * *** Process Flow *** - * - * WordPress calls the plugin index file. All plugin processing starts here. - * - * The plugin index file performs the following operations ... - * - Sets-up any required plugin-wide defines and data - * - Instatiates any plugin-wide classes and objects - * - Sets-up any plugin-wide WordPress hooks - * - Determines which controller is to be executed - * - Executes the selected controller - * - * The selected controller performs the following operations ... - * - Sets-up any controller specific defines and data - * - Instatiates any controller specific classes and objects - * - Sets-up any controller specific WordPress hooks - * - Determines which model process is to be executed - * - Executes the selected model - * - * The selected model performs the following operations ... - * - Sets-up any model specific defines and data - * - Instatiates any model specific classes and objects - * - Sets-up any model specific WordPress hooks - * - Performs any specific processing required of the model - * - Determines which view is to be used to generate output - * - Generates output based on model data and the selected view - * - * WordPress wraps everything up - * - * ******************************************************************************** - */ - -// Check that we're being called by WordPress. -if (!defined('ABSPATH')) { - die("Please do not call this code directly!"); -} - -/* - * - * Some initial setup and tests - * - */ - -$startupNotices = ''; - -// Get standard defined parameters -require_once('defines.php'); - -// Get configuration -require_once('config.php'); - -// Try to set the DB version option to false (new plugin) - If it's already set this won't do anything. -add_option('glmMembersDatabaseDbVersion', false); - -/* - * - * Hook in add-ons and integrate their actions - * - * Each add-on should add an array element to the supplied array using the following structure. - * - * $addOns[{slug for add-on}] = array( - * 'dir' => {path to add-on directory}, - * 'name' => {text name for add-on}, - * 'short_name' => {an abreviated name for the add-on}, - * 'slug' => {slug for add-on}, - * 'config' => {optional array of config data to be merged into $config}, - * 'actions' => array( - * 'adminActions => array( - * '{menu name}' => array( - * '{action}' => '{add-on slug}', - * ... additional actions ... - * ), - * ... additional menu names ... - * 'frontActions' => array( - * '{page}' => array( - * '{action name}' => '{add-on slug}', - * ... addional actions --- - * ), - * ... additional pages ... - * ) - * ), - * 'shortcodes' => array( - * '{shortcode} => array( - * 'plugin' => {plugin slug}, - * 'menu' => '{menu}, - * 'action' => '{action}', - * 'table' => {table name where default values for 'attributes' are stored}, - * 'adttributes' => array({array of attributes that might be in the shortcode}) - * ), - * ... additional shortcodes ... - * ), - * // if the add-on is adding database tables use this, otherwise FALSE - * 'database' => array( - * 'dbPrefix' => '{database prefix to use}', - * 'dbCurrentVersion' => '{current add-on database version number}', - * 'dbActiveVersionOption' => '{option name used to get current active database version}', - * 'dbScriptPath' => '{full path to add-on database scripts directory}', - * 'dbVersions' => array( - * '{version#}' => array('version' => '{version#}', 'tables' => {# of tables}, - * ... additional versions in order of version number - highest is last --- - * ) - * - * ) - * - * Note that the database prefix must not start with 'glm_members_'. It can however be something - * like 'glm_membersPackaging_', otherwise the tables will be counted along with those of the main - * plugin and database checks will fail. - * - * Also note that the default array includes information on the main member db plugin. This is - * done for consistency, particularly for database maintenance - */ -require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/validActions.php'); -require_once(GLM_MEMBERS_PLUGIN_SETUP_PATH.'/shortcodes.php'); -require_once(GLM_MEMBERS_PLUGIN_DB_SCRIPTS.'/dbVersions.php'); -$config['addOns'] = array( - GLM_MEMBERS_PLUGIN_SLUG => array( - 'dir' => GLM_MEMBERS_PLUGIN_PATH, - 'name' => GLM_MEMBERS_PLUGIN_NAME, - 'short_name' => GLM_MEMBERS_PLUGIN_SHORT_NAME, - 'slug' => GLM_MEMBERS_PLUGIN_SLUG, - 'actions' => $glmMembersValidActions, - 'shortcodes' => $glmMembersShortcodes, - 'shortcodesDescription' => $glmMembersShortcodesDescription, - 'database' => array( - 'dbPrefix' => GLM_MEMBERS_PLUGIN_DB_PREFIX, - 'dbCurrentVersion' => GLM_MEMBERS_PLUGIN_DB_VERSION, - 'dbActiveVersionOption' => GLM_MEMBERS_PLUGIN_ACTIVE_DB_OPTION, - 'dbScriptPath' => GLM_MEMBERS_PLUGIN_DB_SCRIPTS, - 'dbVersions' => $glmMembersDbVersions - ) - ) -); - -// Create hook for registering add-on plugins and their features -$config['addOns'] = apply_filters('glm-member-db-register-addon', $config['addOns']); - -// If any add-ons have registered -$config['validActions'] = array(); -$config['shortcodes'] = array(); -if (count($config['addOns']) > 0) { - - // For each add-on that's registered - foreach ($config['addOns'] as $a) { - - // Add their valid actions to the main validActions config array - if (isset($a['actions'])) { - $config['validActions'] = array_merge_recursive($config['validActions'], $a['actions']); - } - - // Add their shortcodes to the main shortcodes config array - if (isset($a['shortcodes'])) { - $config['shortcodes'] = array_merge_recursive($config['shortcodes'], $a['shortcodes']); - } - - // If the add-on has supplied additional config parameters when registering - if (isset($a['config'])) { - $config = array_merge_recursive($config, $a['config']); - } - - // If the add-on has additional config parameters in a plugin.ini file - $iniFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.'/'.$a['slug'].'/config/plugin.ini'; - if (isset($iniFile)) { - - // Parse the add-on's configuration file - $addOnIni = parse_ini_file($iniFile); - - // Replace parameters that are in the theme ini file - $config = array_replace($config, $addOnIni); - - } - } -} - -/* - * - * Activate and Deactivate hooks - * - */ - -// Activate -function glmMembersPluginActivate () -{ - global $wpdb, $config; - require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php'); - new glmMembersPluginActivate($wpdb, $config); -} -register_activation_hook(__FILE__, 'glmMembersPluginActivate'); - -// Deactivate -function glmMembersPluginDeactivate () -{ - global $wpdb, $config; - require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php'); - $x = new glmMembersPluginDeactivate($wpdb, $config); - return false; -} -register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate'); - -/* - * - * Load any other common files needed - * - */ - -// Load data abstract -require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php'); - -// Load glmPluginSupport class -require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php'); - -// Load Smarty Template Support -require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php'); - -/* - * Hook through which an add-on may supply additional logged in user information and - * have that data stored in the config array. Typically it would be the - * glm-members-db-contacts add-on supplying the information. - * - * This hook provides default data with the current WordPress user 'data' object - * as a 'wpUser' sub-array if a WordPress user is logged in. If not 'wpUser' will - * be false. The supplied data is the basic information on the WordPress user - * provided by the 'data' object from wp_get_current_user(). - * - * To permit more than one routine to access this filter and therefore to supply - * additional information on the logged in user, code may merge it's own data or may - * add another sub-array containing user information specific to an add-on (i.e. - * contacts add-on might supply a 'contactUser' sub-array). - * - */ -if (function_exists('is_user_logged_in')) { - $config['loggedInUser'] = array( - 'wpUser' => false - ); - if (is_user_logged_in()) { - $config['loggedInUser']['wpUser'] = (array) wp_get_current_user()->data; - } - $config['loggedInUser'] = apply_filters('glm_members_current_logged_in_user', $config['loggedInUser']); -} - -/* - * - * Determine which controller to load - * - */ - -// If the call to this code is to display a separate debug window -if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) { - glmMembersAdminNotices(true); - exit; - -// Otherwise select appropriate controller -} elseif (is_admin()) { - require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php'); - new glmMembersAdmin($wpdb, $config); -} else { - require_once (GLM_MEMBERS_PLUGIN_PATH . '/controllers/front.php'); - new glmMembersFront($wpdb, $config); -} - -/* - * Display any notices? - */ - -// Display any notices that need to be displayed at the top of the admin content area -function glmMembersWordpressAdminNotices() { - global $startupNotices; - echo '
".print_r($sql,1).""; + + // If $start and $limit, we're doing paging + $paging = false; + if ($start !== false && $limit > 0) { + $sql .= "limit ".($start-1).", $limit"; + $paging = true; + } + if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) { $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getList() query"); } @@ -3121,8 +3140,10 @@ abstract class GlmDataAbstract return false; } - // Process field output data for each result - use ID field as key + // Setup result array $newList = array(); + + // Process field output data for each result - use ID field as key while (list($k, $v) = each($list)) { $newList[$v['id']] = $this->processOutputData($v, 'l'); } @@ -3131,6 +3152,20 @@ abstract class GlmDataAbstract $this->addDataAbstractNotice($newList, 'DataBlock', "getList() data"); } + + // If we're doing paging, return that data along with the list + if ($paging) { + $c = count($list); + return array( + 'start' => $start, + 'limit' => $limit, + 'returned' => $c, + 'last' => $start + count($list) - 1, + 'list' => $newList + ); + } + + // Since we're not doing paging, return the list only return $newList; } @@ -3140,29 +3175,37 @@ abstract class GlmDataAbstract * @return void * @access public */ - public function getEntry($id, $idfield = 'id', $where = '', $fieldVals = false) + public function getEntry($id, $idfield = 'id', $where = 'true', $fieldVals = false) { - if ($id-0 == 0) { -// echo "DataAbstract.php - getEntry() called with invalid ID"; - return false; - } + // If there's an ID supplied, add that to the query + $idWhere = ''; + if ($id-0 > 0) { + $idWhere = "AND $idfield = $id"; + } - $this->buildFieldsList('g'); + // If there's no ID supplied and there's no where clause, what are we doing here? + if ($idWhere == '' and $where == 'true') { + return false; + } + + $this->buildFieldsList('g'); + // Get only the first result $sql = "SELECT $this->select FROM $this->table T - WHERE $idfield = $id - $where + WHERE $where + $idWhere + LIMIT 1 ;"; $detail = $this->wpdb->get_row($sql, ARRAY_A); $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getEntry() query"); // If nothing was found, simply return false - if ($detail == false) { - return false; - } + if ($detail == false) { + return false; + } // Process individual fields $detail = $this->processOutputData($detail, 'g', $fieldVals); diff --git a/lib/GlmDataAbstract/documentation.odt b/lib/GlmDataAbstract/documentation.odt index 21f30b1f..033ff2c4 100644 Binary files a/lib/GlmDataAbstract/documentation.odt and b/lib/GlmDataAbstract/documentation.odt differ diff --git a/models/admin/management/theme.php b/models/admin/management/theme.php new file mode 100644 index 00000000..c57a4ff6 --- /dev/null +++ b/models/admin/management/theme.php @@ -0,0 +1,184 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load Members data abstract +require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/settings/dataSettingsTheme.php'); + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersAdmin_management_theme extends GlmDataSettingsTheme +{ + + /** + * 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 method does the work for this model and returns any resulting data + * + * @return array Status and data array + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + */ + public function modelAction ($actionData = false) + { + // General settings are always stored in a record with ID=1. + $id = 1; + + // Determine if current user can edit configurations + if (!current_user_can('glm_members_settings')) { + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'User does not have rights to make configuration changes.' + ) + ); + } + + // Check for submission option + $option = ''; + if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { + $option = $_REQUEST['option']; + } + + switch($option) { + + // Update the settings and redisplay the form + case 'submit': + + // Update the general settings + $themeSettings = $this->updateEntry(1); + + // Display admin message that the data has been updated + glmMembersAdmin::addNotice('Theme Settings for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice'); + + break; + + // Default is to get the current settings and display the form + default: + + // Try to get the first (should be only) entry for general settings. + $themeSettings = $this->editEntry($id); + + // Check that we actually have the theme + if ($themeSettings === false) { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("/modesl/admin/settings/theme.php: Unable to load Theme Settings.", 'Alert'); + } + + return array( + 'status' => false, + 'menuItemRedirect' => 'error', + 'modelRedirect' => 'index', + 'view' => 'admin/error/index.html', + 'data' => array( + 'reason' => 'Unable to create theme settings entry in database.' + ) + ); + } + + break; + + } + + // Compile template data + $templateData = array( + 'reason' => '', + 'themeSettings' => $themeSettings, +// 'canEdit' => $canEdit + ); + + // Return status, suggested view, and data to controller + return array( + 'status' => true, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/management/theme.html', + 'data' => $templateData + ); + + } + +} + +?> \ No newline at end of file diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index 5ab5b792..d23b73f3 100644 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -256,6 +256,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo $this->memberData = $Members->getEntry($this->memberID); $this->fields['logo']['i_prefix'] = 'memb_'.$this->memberID.'_'; $this->haveMember = true; + $memberName = $this->memberData['name']; // If no member info record, assume that we need to create a new one diff --git a/models/admin/members/list.php b/models/admin/members/list.php index b46a274e..c2995b1a 100644 --- a/models/admin/members/list.php +++ b/models/admin/members/list.php @@ -108,6 +108,15 @@ class GlmMembersAdmin_members_list extends GlmDataMembers $filterPending = false; $filterArchived = false; $haveFilter = false; + $numbDisplayed = false; + $lastDisplayed = false; + $paging = true; + $prevStart = false; + $nextStart = false; + $start = 1; + $limit = 20; // Set to the number of listings per page + $namesList = false; + // Check if this is a request to show archived members if (isset($_REQUEST['filterArchived'])) { @@ -117,7 +126,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers // If not, don't show them } else { - $where .= " AND T.access != ".$this->config['access_numb']['Archived']; + $where .= " AND access != ".$this->config['access_numb']['Archived']; } // Get a list of categories for filtering @@ -172,13 +181,60 @@ class GlmMembersAdmin_members_list extends GlmDataMembers $haveFilter = true; } + // Get count of members listed + $memberCount = $this->getStats($where); + + // If the number of members is less than a page, don't do paging + if ($memberCount <= $limit) { + $paging = false; + } + + // Get full list of names matching this where clause for search box + $namesList = $this->getIdName($where); + + // Check if we're doing paging + if (isset($_REQUEST['pageSelect'])) { + + // If request is for Next + if ($_REQUEST['pageSelect'][0] == 'N') { + $newStart = $_REQUEST['nextStart'] - 0; + + // Otherwise it must be Previous + } else { + $newStart = $_REQUEST['prevStart'] - 0; + } + + if ($newStart > 0) { + $start = $newStart; + } + } + // Get a current list of members - $list = $this->getSimpleMembersList($where); + $listResult = $this->getSimpleMembersList($where, 'name', true, 'id', $start, $limit); + + // Get paging results + $numbDisplayed = $listResult['returned']; + $lastDisplayed = $listResult['last']; + if ($start == 1) { + $prevStart = false; + } else { + $prevStart = $start - $limit; + if ($start < 1) { + $start = 1; + } + } + if ($listResult['returned'] == $limit) { + $nextStart = $start + $limit; + } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) { glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data'); } + // since we're doing paging, we have to break out just the member data + $list = $listResult['list']; + unset($listResult); + // If we have list entries - even if it's an empty list $success = true; $haveMembers = false; @@ -205,7 +261,15 @@ class GlmMembersAdmin_members_list extends GlmDataMembers 'categories' => $categories, 'haveFilter' => $haveFilter, 'filterArchived' => $filterArchived, - 'filterPending' => $filterPending + 'filterPending' => $filterPending, + 'numbDisplayed' => $numbDisplayed, + 'lastDisplayed' => $lastDisplayed, + 'paging' => $paging, + 'prevStart' => $prevStart, + 'nextStart' => $nextStart, + 'start' => $start, + 'limit' => $limit, + 'namesList' => $namesList ); // Return status, suggested view, and data to controller diff --git a/setup/adminMenus.php b/setup/adminMenus.php index 9cb7c9e9..570852af 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -38,12 +38,22 @@ if (apply_filters('glm_members_menu_members', true)) { add_menu_page( 'Members', - 'Members', + 'GLM Associate', 'glm_members_main_menu', 'glm-members-admin-menu-members', - function() {$this->controller('members');}, + function() {}, false, - '91.123' + '3.100' + ); + + // Add a sub-submenu for the "Member" "List" page + add_submenu_page( + 'glm-members-admin-menu-members', + 'Members List', + 'Members', + 'glm_members_main_menu', + 'glm-members-admin-menu-members', + function() {$this->controller('members', 'index');} ); // Add a sub-submenu for the "Member" "List" page diff --git a/setup/databaseScripts/create_database_V1.1.2.sql b/setup/databaseScripts/create_database_V1.1.2.sql deleted file mode 100644 index 0d2d1b53..00000000 --- a/setup/databaseScripts/create_database_V1.1.2.sql +++ /dev/null @@ -1,505 +0,0 @@ --- Gaslight Media Members Database --- File Created: 12/09/14 15:27:15 --- Database Version: 1.0.43 --- 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 amenitites 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 ameities table entry - to simplify searches - ref_dest INT NULL, -- Pointer to the specific entity of type ref_type - amenity_value TINYTEXT NULL, -- Quanity if amenity uses values - PRIMARY KEY (id), - INDEX(ref_type), - INDEX(ref_dest) -); - ----- - --- 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 speific 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 infomation 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 - PRIMARY KEY (id) -); - ----- - --- Contacts - used by various entities -CREATE TABLE {prefix}contacts ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Contact is active flag - access INT NULL, -- Access type - See access table in plugin.ini - fname TINYTEXT NULL, -- First name of contact - lname TINYTEXT NULL, -- Last name of contact - contact_type INT NULL, -- Contact type - see contact_type table (individual, role, ...) - contact_role INT NULL, -- Contact WordPress user Role - org TINYTEXT NULL, -- Organization name - title TINYTEXT NULL, -- Title/Position - descr TEXT NULL, -- Description of position/responsibilities - Displayed - image TINYTEXT NULL, -- Image - addr1 TINYTEXT NULL, -- Address line 1 - Address is for contact, not necessarily for organization - 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 contact location - lon FLOAT NULL, -- Longitude of contact location - url TINYTEXT NULL, -- URL to information regarding this contact - office_phone TINYTEXT NULL, -- Office phone number - home_phone TINYTEXT NULL, -- Home phone number - or after-hours phone number - mobile_phone TINYTEXT NULL, -- Mobile phone number - alt_phone TINYTEXT NULL, -- An alternate phone number - fax TINYTEXT NULL, -- FAX number (do people still use these?) - email TINYTEXT NULL, -- E-Mail address - alt_email TINYTEXT NULL, -- Alternate E-Mail address - Also used to log-in - username TINYTEXT NULL, -- Optional username to use for login - password TINYTEXT NULL, -- Encrypted password - notes TEXT NULL, -- Notes - Not displayed on front-end - create_time TIMESTAMP NULL, -- Create date/time - modify_time TIMESTAMP NULL, -- Last modified date/time - ref_type INT NULL, -- Type of entity this contact is associated with - ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with - PRIMARY KEY (id), - INDEX(fname(20)), - INDEX(lname(20)), - INDEX(city), - INDEX(zip(10)), - INDEX(lat), - INDEX(lon), - INDEX(email(20)) -); - ----- - --- 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 - 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 INT NULL, -- Old member ID if imported from old database - PRIMARY KEY (id), - INDEX(name(20)), - INDEX(member_slug(20)), - INDEX(created) -); - ----- - --- Member information version record - May be multiples per member - Only one with stauts "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, -- Refernce name for this member information record - Not displayed on front-end - 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 - phone TINYTEXT NULL, -- Primary phone number - toll_free TINYTEXT NULL, -- Toll Free phone number - url TINYTEXT NULL, -- URL with information about this member - 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 - 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) -); - ----- - --- 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, -- Descrption of region - short_descr TINYTEXT NULL, -- Short descroption of region - PRIMARY KEY (id) -); - ----- - --- 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 '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 '0', - list_show_creditcards BOOLEAN DEFAULT '0', - 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 '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_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) -); - ----- - --- 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 ) - VALUES - ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' ) -; - ----- - --- Terms used in site modifiable on Management page in admin - Only 1 entry in this table --- Tems 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_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) -); - ----- - --- 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_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', - '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' - ) -; diff --git a/setup/databaseScripts/create_database_V1.1.4.sql b/setup/databaseScripts/create_database_V1.1.4.sql new file mode 100644 index 00000000..e3f61fae --- /dev/null +++ b/setup/databaseScripts/create_database_V1.1.4.sql @@ -0,0 +1,479 @@ +-- Gaslight Media Members Database +-- File Created: 12/09/14 15:27:15 +-- Database Version: 1.1.4 +-- 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 amenitites 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 ameities table entry - to simplify searches + ref_dest INT NULL, -- Pointer to the specific entity of type ref_type + amenity_value TINYTEXT NULL, -- Quanity if amenity uses values + PRIMARY KEY (id), + INDEX(ref_type), + INDEX(ref_dest) +); + +---- + +-- 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 speific 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 infomation 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 + PRIMARY KEY (id) +); + +---- + +-- 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 + 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 INT NULL, -- Old member ID if imported from old database + PRIMARY KEY (id), + INDEX(name(20)), + INDEX(member_slug(20)), + INDEX(created) +); + +---- + +-- Member information version record - May be multiples per member - Only one with stauts "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, -- Refernce name for this member information record - Not displayed on front-end + 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 + phone TINYTEXT NULL, -- Primary phone number + toll_free TINYTEXT NULL, -- Toll Free phone number + url TINYTEXT NULL, -- URL with information about this member + 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 + 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) +); + +---- + +-- 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, -- Descrption of region + short_descr TINYTEXT NULL, -- Short descroption of region + PRIMARY KEY (id) +); + +---- + +-- 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 '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 '0', + list_show_creditcards BOOLEAN DEFAULT '0', + 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 '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_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) +); + +---- + +-- 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 ) + VALUES + ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' ) +; + +---- + +-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table +-- Tems 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_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) +); + +---- + +-- 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_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', + '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' + ) +; + +---- + +-- 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 + ) +; + diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 1da28f88..2337d535 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -33,7 +33,9 @@ $glmMembersDbVersions = array( '1.0.43' => array('version' => '1.0.43', 'tables' => 26), '1.1.0' => array('version' => '1.1.0', 'tables' => 13), '1.1.1' => array('version' => '1.1.1', 'tables' => 13), - '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16') + '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16'), + '1.1.3' => array('version' => '1.1.3', 'tables' => 13, 'date' => '4/13/16'), + '1.1.4' => array('version' => '1.1.4', 'tables' => 14, 'date' => '4/18/16') ); diff --git a/setup/databaseScripts/drop_database_V1.1.2.sql b/setup/databaseScripts/drop_database_V1.1.2.sql deleted file mode 100644 index 78bacb57..00000000 --- a/setup/databaseScripts/drop_database_V1.1.2.sql +++ /dev/null @@ -1,23 +0,0 @@ --- Gaslight Media Members Database --- File Created: 12/09/14 15:27:15 --- Database Version: 1.1.1 --- Database Deletion Script --- Note: Tables with DELETE CASCADE must appear before referenced table - -DROP TABLE IF EXISTS - {prefix}amenities, - {prefix}amenity_ref, - {prefix}category_member_info, - {prefix}cities, - {prefix}contacts, - {prefix}images, - {prefix}files, - {prefix}members, - {prefix}member_info, - {prefix}member_type, - {prefix}regions, - {prefix}settings_general, - {prefix}settings_terms, - {prefix}categories -; - diff --git a/setup/databaseScripts/drop_database_V1.1.3.sql b/setup/databaseScripts/drop_database_V1.1.3.sql new file mode 100644 index 00000000..17b02fda --- /dev/null +++ b/setup/databaseScripts/drop_database_V1.1.3.sql @@ -0,0 +1,23 @@ +-- Gaslight Media Members Database +-- File Created: 12/09/14 15:27:15 +-- Database Version: 1.1.1 +-- Database Deletion Script +-- Note: Tables with DELETE CASCADE must appear before referenced table + +DROP TABLE IF EXISTS + {prefix}amenities, + {prefix}amenity_ref, + {prefix}category_member_info, + {prefix}cities, + {prefix}images, + {prefix}files, + {prefix}members, + {prefix}member_info, + {prefix}member_type, + {prefix}regions, + {prefix}settings_general, + {prefix}settings_terms, + {prefix}settings_theme, + {prefix}categories +; + diff --git a/setup/databaseScripts/update_database_V1.1.3.php b/setup/databaseScripts/update_database_V1.1.3.php new file mode 100644 index 00000000..a6fb85ce --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.3.php @@ -0,0 +1,17 @@ +wpdb->query(" + RENAME TABLE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."contacts TO ".$prefix."contacts; +"); diff --git a/setup/databaseScripts/update_database_V1.1.3.sql b/setup/databaseScripts/update_database_V1.1.3.sql new file mode 100644 index 00000000..e748a976 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.3.sql @@ -0,0 +1,11 @@ +-- Gaslight Media Members Database +-- File Created: 11/11/16 15:27:15 +-- Database Version: 1.1.2 +-- 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 + +-- Move contacts table to contacts plugin - Rename prefix +-- Doing nothing here - See update_database_V1.1.3.php + diff --git a/setup/databaseScripts/update_database_V1.1.4.sql b/setup/databaseScripts/update_database_V1.1.4.sql new file mode 100644 index 00000000..7b803183 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.4.sql @@ -0,0 +1,31 @@ +-- Gaslight Media Members Database +-- File Created: 11/11/16 15:27:15 +-- Database Version: 1.1.4 +-- 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 + +-- Move contacts table to contacts plugin - Rename prefix +-- Doing nothing here - See update_database_V1.1.3.php + + +-- 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 + ) +; + diff --git a/setup/validActions.php b/setup/validActions.php index f3b9208c..651e9545 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -62,6 +62,7 @@ $glmMembersValidActions = array( 'index' => 'glm-member-db', // General Options 'terms' => 'glm-member-db', 'development' => 'glm-member-db', + 'theme' => 'glm-member-db', 'import' => 'glm-member-db', 'addons' => 'glm-member-db', 'hooks' => 'glm-member-db' diff --git a/views/admin/management/header.html b/views/admin/management/header.html index 913b6f0a..da746808 100644 --- a/views/admin/management/header.html +++ b/views/admin/management/header.html @@ -5,8 +5,9 @@
+ NOTE: + There are no actual theme settings added to the database yet. This tab has been setup as + a place where theme settings can be managed. There will be a database error displayed + if this form is submitted because there are no fields other than ID in the "settings_theme" + table. Please remove this message when data fields have been added to the database and + this template has been updated with the new fields. +
+ + + +{include file='admin/footer.html'} diff --git a/views/admin/members/list.html b/views/admin/members/list.html index 94ea6c29..c4abd3ca 100644 --- a/views/admin/members/list.html +++ b/views/admin/members/list.html @@ -1,8 +1,12 @@ {include file='admin/members/header.html'} - -ID | -Member Name | -Access | -Member Type | -Date Created | -
---|---|---|---|---|
- {$m.id} - Active Profile - | -- {$m.name} - | -- {$m.access_short.name} - | -- {$m.member_type_short} - | -- {$m.created.date} - | -
(no members listed) |