--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Events
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataEventsCategories extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'categories';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Name
+ 'name' => array(
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'unique' => true,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array(
+ 'field' => 'descr',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Parent - for adding, deleting and editing, has selection tabels
+ 'parent' => array(
+ 'field' => 'parent',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'categories',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'force_list' => true,
+ 'required' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
+
+?>
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Events
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataEventsEventCategories extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event ID
+ 'event' => array(
+ 'field' => 'event',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Category ID
+ 'category' => array(
+ 'field' => 'category',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Category Name - for easy reference
+ 'category_name' => array(
+ 'field' => 'category',
+ 'as' => 'category_name',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'categories',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'use' => 'gl'
+ )
+
+
+ );
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
+
+?>
/*
* Table Name
*/
- $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'eventstable';
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events';
/*
* Table Data Fields
'use' => 'a'
),
- // Active flag
- 'active' => array (
- 'field' => 'active',
+ // Status
+ 'status' => array (
+ 'field' => 'status',
+ 'type' => 'list',
+ 'list' => $this->config['status'],
+ 'required' => true,
+ 'default' => $this->config['status_numb']['Pending'],
+ 'use' => 'a'
+ ),
+
+ // Custom Time Pointer
+ 'custom_time' => array (
+ 'field' => 'custom_time',
+ 'type' => 'integer',
+ 'use' => 'gle'
+ ),
+
+ // Root Event Pointer
+ 'root_event' => array (
+ 'field' => 'root_event',
+ 'type' => 'integer',
+ 'use' => 'gle'
+ ),
+
+ // Date/Time Created
+ 'created' => array (
+ 'field' => 'created',
+ 'type' => 'datetime',
+ 'use' => 'lgie'
+ ),
+
+ // Date/Time Updated
+ 'updated' => array (
+ 'field' => 'updated',
+ 'type' => 'datetime',
+ 'use' => 'a'
+ ),
+
+ // Date/Time Approved
+ 'approved' => array (
+ 'field' => 'approved',
+ 'type' => 'datetime',
+ 'use' => 'lge'
+ ),
+
+ // Reference Type - Insert new record
+ 'ref_type_insert' => array (
+ 'field' => 'ref_type',
+ 'type' => 'integer',
+ 'use' => 'i'
+ ),
+
+ // Reference Type - Output only
+ 'ref_type' => array (
+ 'field' => 'ref_type',
+ 'type' => 'list',
+ 'list' => $this->config['ref_type'],
+ 'use' => 'lged'
+ ),
+
+ // Reference Target - Insert new record and for recall
+ 'ref_dest' => array (
+ 'field' => 'ref_dest',
+ 'type' => 'integer',
+ 'use' => 'ilged'
+ ),
+
+ // Hide Address flag
+ 'hide_address' => array (
+ 'field' => 'hide_address',
'type' => 'checkbox',
- 'default' => true,
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Featured Event flag
+ 'featured' => array (
+ 'field' => 'featured',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Slide Show flag
+ 'slideshow' => array (
+ 'field' => 'slideshow',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Major Event flag
+ 'major' => array (
+ 'field' => 'major',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Event Name
+ 'name' => array (
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Header
+ 'header' => array (
+ 'field' => 'header',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Intro Text
+ 'intro' => array (
+ 'field' => 'intro',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Description
+ 'descr' => array (
+ 'field' => 'descr',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Event Image
+ 'image' => array(
+ 'field' => 'image',
+ 'type' => 'image',
+ 'use' => 'a'
+ ),
+
+ // Evnet URL
+ 'url' => array (
+ 'field' => 'url',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Cost (description)
+ 'cost' => array (
+ 'field' => 'cost',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Notes (informational)
+ 'notes' => array (
+ 'field' => 'notes',
+ 'type' => 'text',
'use' => 'a'
)
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Events
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataEventsLocations extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event ID
+ 'event' => array(
+ 'field' => 'event',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Location Name
+ 'name' => array (
+ 'field' => 'name',
+ 'type' => 'text',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Location Address
+ 'address' => array (
+ 'field' => 'address',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+
+ // City - References main plugin cities table
+ 'city' => array (
+ 'field' => 'city',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'use' => 'a'
+ ),
+
+ // State
+ 'state' => array (
+ 'field' => 'state',
+ 'type' => 'list',
+ 'list' => $this->config['states'],
+ 'default' => 'MI',
+ 'use' => 'a'
+ ),
+
+ // ZIP / Postal Code
+ 'zip' => array (
+ 'field' => 'zip',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Country
+ 'country' => array (
+ 'field' => 'country',
+ 'type' => 'list',
+ 'list' => $this->config['countries'],
+ 'default' => 'US',
+ 'use' => 'a'
+ ),
+
+ // Latitude
+ 'lat' => array(
+ 'field' => 'lat',
+ 'type' => 'float',
+ 'default' => $this->config['settings']['maps_default_lat'],
+ 'use' => 'a'
+ ),
+
+ // Longitude
+ 'lon' => array(
+ 'field' => 'lon',
+ 'type' => 'float',
+ 'default' => $this->config['settings']['maps_default_lon'],
+ 'use' => 'a'
+ ),
+
+ // Region - References main plugin regions table
+ 'region' => array (
+ 'field' => 'region',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ // 'force_list' => true,
+ 'use' => 'a'
+ ),
+
+ // Phone Number
+ 'phone' => array (
+ 'field' => 'phone',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // URL
+ 'url' => array (
+ 'field' => 'url',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // E-Mail
+ 'email' => array (
+ 'field' => 'email',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // ZIP / Postal Code
+ 'zip' => array (
+ 'field' => 'zip',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Contact Reference - Points to Contacts add-on contacts table
+ 'region' => array (
+ 'field' => 'region',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'regions',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ // 'force_list' => true,
+ 'use' => 'a'
+ ),
+
+ // Contact Reference Placeholder if no Contacts Add-On (see below)
+ 'contact_addon_id' => array(
+ 'field' => 'contact_addon_id',
+ 'type' => 'integer',
+ 'use' => 'a'
+ ),
+
+ /*
+ * Using first and last name for compatibility with contacts add-on data
+ */
+
+ // Contact First Name
+ 'contact_fname' => array (
+ 'field' => 'contact_fname',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Contact Last Name
+ 'contact_lname' => array (
+ 'field' => 'contact_lname',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Contact phone
+ 'contact_phone' => array (
+ 'field' => 'contact_phone',
+ 'type' => 'text',
+ 'use' => 'a'
+ ),
+
+ // Contact E-Mail Address
+ 'contact_email' => array (
+ 'field' => 'contact_email',
+ 'type' => 'text',
+ 'use' => 'a'
+ )
+
+ );
+
+ // If the Contacts add-on exists
+ if (isset($this->config['addOns']['glm-member-db-contacts'])) {
+
+ // Contact Reference - Points to Contacts add-on contacts table
+ $this->fields['contact_addon_id'] = array (
+ 'field' => 'contact_addon_id',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'contacts',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ // 'force_list' => true,
+ 'use' => 'a'
+ );
+
+
+ }
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
+
+?>
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Events
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataEventsRecurrences extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event ID
+ 'event' => array(
+ 'field' => 'event',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ // Start Date & Time
+ 'start_time' => array (
+ 'field' => 'start_time',
+ 'type' => 'datetime',
+ 'use' => 'a'
+ ),
+
+ // End Date & Time
+ 'end_time' => array (
+ 'field' => 'end_time',
+ 'type' => 'datetime',
+ 'use' => 'a'
+ ),
+
+ // All Day Flag
+ 'all_day' => array (
+ 'field' => 'all_day',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Month of Year - multi-pick (bitmap)
+ 'month_of_year' => array(
+ 'field' => 'month_of_year',
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config['month'],
+ 'default' => 0, // no months selected
+ 'use' => 'a'
+ ),
+
+ // Week of Month - multi-pick (bitmap)
+ 'week_of_month' => array(
+ 'field' => 'week_of_month',
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config['week'],
+ 'default' => 0, // no weeks selected
+ 'use' => 'a'
+ ),
+
+ // Day of Week - multi-pick (bitmap)
+ 'day_of_week' => array(
+ 'field' => 'day_of_week',
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config['day'],
+ 'default' => 0, // no days selected
+ 'use' => 'a'
+ ),
+
+ // Day of Month - multi-pick (bitmap)
+ 'day_of_month' => array(
+ 'field' => 'day_of_month',
+ 'type' => 'bitmap',
+ 'bitmap' => $this->config['day'],
+ 'default' => 0, // no day selected
+ 'use' => 'a'
+ ),
+
+ /*
+ * Following included for future Holiday feature
+ */
+
+ // Holiday Index
+ 'holiday' => array(
+ 'field' => 'holiday',
+ 'type' => 'integer',
+ 'use' => 'g'
+ ),
+
+ // Holiday Offset (days +/-)
+ 'holiday_offset' => array(
+ 'field' => 'holiday_offset',
+ 'type' => 'integer',
+ 'use' => 'g'
+ )
+
+ );
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
+
+?>
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Events
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataEvent class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataEventsTimes extends GlmDataAbstract
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Data Table Name
+ *
+ * @var $table
+ * @access public
+ */
+ public $table;
+ /**
+ * Field definitions
+ *
+ * 'type' is type of field as defined by the application
+ * text Regular text field
+ * pointer Pointer to an entry in another table
+ * 'filters' is the filter name for a particular filter ID in PHP filter
+ * functions
+ * See PHP filter_id()
+ *
+ * 'use' is when to use the field
+ * l = List
+ * g = Get
+ * n = New
+ * i = Insert
+ * e = Edit
+ * u = Update
+ * d = Delete
+ * a = All
+ *
+ * @var $ini
+ * @access public
+ */
+ public $fields = false;
+ /**
+ * MemberInfo DB object
+ *
+ * @var $MemberInfo
+ * @access public
+ */
+ public $MemberInfo;
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ * @param bool $limitedEdit Flag to say indicate limited edit requested
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config, $limitedEdit = false)
+ {
+
+ // If this class is not being extended along with existing $wpdb and $config
+ if (!$this->wpdb) {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ }
+
+ /*
+ * Table Name
+ */
+ $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'times';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event ID
+ 'event' => array(
+ 'field' => 'event',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'glei'
+ ),
+
+ // Custom Event ID
+ 'custom_event' => array(
+ 'field' => 'custom_event',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'glei'
+ ),
+
+ // Active Flag
+ 'active' => array (
+ 'field' => 'active',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
+ // Start Date & Time
+ 'start_time' => array (
+ 'field' => 'start_time',
+ 'type' => 'datetime',
+ 'use' => 'a'
+ ),
+
+ // End Date & Time
+ 'end_time' => array (
+ 'field' => 'end_time',
+ 'type' => 'datetime',
+ 'use' => 'a'
+ ),
+
+ // All Day Flag
+ 'all_day' => array (
+ 'field' => 'all_day',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ )
+
+ );
+
+ }
+
+ /*
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * In this case we're using it to append an array of category
+ * data to each member result and also sort by member name.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing($r, $a)
+ {
+ return $r;
+ }
+
+}
+
+?>
* Plugin Name: GLM Members Database Events
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 0.0.6
+ * Version: 0.0.1
* Author: Chuck Scott
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
*/
-/**********************************************************************
- * NOTE: THIS IS A EVENTS FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to events, Events, or EVENTS to a name
- * appropriate for your new Add-On.
- *
- * This is the main file for this add-on. It is the file called by
- * WordPress to run aspects of this add-on.
- *
- * NOTE: Versions in this file must be reset as appropriate when
- * creating a new add-on. Be sure to preserve the versions listed
- * for "...MIN_MEMBERS_REQUIRED_VERSION".
- *
- * Remove this message before using this file in production!
- **********************************************************************/
/**
* Gaslight Media Members Database Events Add-On
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.6');
-// define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.1');
+define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.1');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.57');
+define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
// Check if plugin version is not current in WordPress option and if needed updated it
if (GLM_MEMBERS_EVENTS_PLUGIN_VERSION != get_option('glmMembersDatabaseEventsPluginVersion')) {
-=== Gaslight Media Member Database Events Child Plugin ===
+=== Gaslight Media Member Database Events Add-On Plugin ===
Contributors: cscott@gaslightmedia.com
Donate link: http://www.gaslightmedia.com
Tags: Gaslight Media,Plugin,Members Events
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
-This is the Gaslight Media Members Database Events Child Plugin.
+This is the Gaslight Media Members Database Events Add-On Plugin.
== Description ==
-The Gaslight Media Members Database Events Child Plugin is an add-on to the Gaslight Media Members Database,
-which is required to install and run this plugin
+The Gaslight Media Members Database Events Add-On Plugin adds Events capabilities to the base plugin.
+The Gaslight Media base Members Database plugin (or later core plugin) is required to activate this add-on.
== Installation ==
+++ /dev/null
--- Gaslight Media Members Database - Events
--- File Created: 12/02/15 15:27:15
--- Database Version: 0.0.1
--- Database Creation Script
---
--- This file is called to create a new set of tables for this
--- add-on for the most receint database version for this add-on.
---
--- There should only be one such file in this directory
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
-
-
--- **********************************************************************
--- NOTE: THIS IS A EVENTS FILE - DO NOT USE UNMODIFIED
---
--- Please change all references to events, Events, or EVENTS to a name
--- appropriate for your new Add-On.
---
--- Tables and queries in this file are events only.
---
--- Remove this message before using this file in production!
--- **********************************************************************/
-
-
--- Events Management Settings
-CREATE TABLE {prefix}management (
- id INT NOT NULL AUTO_INCREMENT,
- canonical_events_page TINYTEXT NULL, -- Canonical page slug for detail
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default events management entry
-INSERT INTO {prefix}management
- ( id, canonical_events_page )
- VALUES
- ( 1, 'events data' )
-;
-
+++ /dev/null
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members Events DB Versions
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link http://dev.gaslightmedia.com/
- */
-
-$glmMembersEventsDbVersions = array(
- '0.0.1' => array('version' => '0.0.1', 'tables' => 2),
- '0.0.2' => array('version' => '0.0.2', 'tables' => 3)
-);
-
+++ /dev/null
-<?php
-/*
- * Gaslight Media Members Database - Events Add-On
- *
- * Database Update Script for version 0.0.2
- */
-
-/*
- * Update events records to build events_slug field data from title
- */
-
-// Get all events records
-$eventsRecords = $this->wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX.'eventss;', ARRAY_A);
-
-// If there's any events records
-if ($eventsRecords && count($eventsRecords) > 0) {
-
- // For each events record
- foreach ($eventsRecords as $p) {
-
- // Create a slug from the title
- $slug = sanitize_title($p['title']).'-'.$p['id'];
-
- // Store this value back into the record
- $this->wpdb->update(
- GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX.'eventss',
- array(
- 'events_slug' => $slug
- ),
- array( 'id' => $p['id'] ),
- array( '%s' ),
- array( '%d')
- );
- }
-
-}
+++ /dev/null
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.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
-
--- Package Management Settings
-CREATE TABLE {prefix}management (
- id INT NOT NULL AUTO_INCREMENT,
- canonical_package_page TINYTEXT NULL, -- Canonical page slug for package detail
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default package management entry
-INSERT INTO {prefix}management
- ( id, canonical_package_page )
- VALUES
- ( 1, 'package-detail' )
-;
-
-----
-
-ALTER TABLE {prefix}packages ADD COLUMN package_slug TINYTEXT;
-
-
-
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Categories - Categories for events
+CREATE TABLE {prefix}categories (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NULL, -- Name of event category
+ descr TINYTEXT NULL, -- Description of this category
+ parent INT NULL, -- Parent category, null or 0 if this is a top level category
+ PRIMARY KEY (id),
+ INDEX(parent)
+);
+
+----
+
+-- Event-Category - Categories for specific event records
+CREATE TABLE {prefix}event_categories (
+ id INT NOT NULL AUTO_INCREMENT,
+ event INT NULL, -- Pointer to the event
+ category INT NULL, -- Pointer to the category
+ PRIMARY KEY (id),
+ INDEX(event),
+ INDEX(category)
+);
+
+----
+
+-- Event Recurrence - Defines how an event recurs
+CREATE TABLE {prefix}recurrences (
+ id INT NOT NULL AUTO_INCREMENT,
+ event INTEGER NULL, -- Pointer to event
+ start_time DATETIME NULL, -- Start of first occurance (date and time)
+ end_time DATETIME NULL, -- End of first occurance (date and time)
+ all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (inforational only)
+ month_of_year SMALLINT UNSIGNED NULL, -- Month of year (bitmap)
+ week_of_month TINYINT UNSIGNED NULL, -- Week of the month (bitmap)
+ day_of_week TINYINT UNSIGNED NULL, -- Day of the week (bitmap)
+ day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap)
+ holiday INT NULL, -- Pointer to holidays list (for future development)
+ holiday_offset TINYINT -- Offset from holiday (from -128 to +127 days)
+ PRIMARY KEY (id),
+ INDEX(event)
+);
+
+----
+
+-- Times - List of actual event times for single and recurring events
+CREATE TABLE {prefix}times (
+ id INT NOT NULL AUTO_INCREMENT,
+ event INT NULL, -- Pointer to the primary record for the event
+ custom_event INT NULL, -- Pointer to a customized copy of the event record (if set)
+ active BOOLEAN NULL, -- Active flag - normally set but used to temporarily dissable a specific date
+ start_time DATETIME NULL, -- Date and time event starts
+ end_time DATETIME NULL, -- Date and time event ends
+ all_day BOOLEAN NULL, -- All Day flag
+ PRIMARY KEY (id),
+ INDEX(event),
+ INDEX(start_time),
+ INDEX(end_time)
+);
+
+----
+
+-- Locations - Locations for event - If there's no location pointing to an event try to use the referernced entity in events table
+CREATE TABLE {prefix}locations (
+ id INT NOT NULL AUTO_INCREMENT,
+ event INT NULL, -- Pointer to the primary or custom event record
+ name TINYTEXT NULL, -- Name of location
+ address TINYTEXT NULL, -- Street Address
+ city INT NULL, -- Pointer to city - references main plugin city table
+ state TINYTEXT NULL, -- Two character state abreviation
+ zip TINYTEXT NULL, -- ZIP/Postal code
+ country TINYTEXT NULL, -- Country Code
+ lat FLOAT NULL, -- Latitude of location
+ lon FLOAT NULL, -- Longitude of location
+ region INT NULL, -- Pointer to Region - references main plugin region table
+ phone TINYTEXT NULL, -- Location Phone #
+ url TINYTEXT NULL, -- Location URL
+ email TINYTEXT NULL, -- Location E-Mail Address
+ contact_addon_id INT NULL, -- ID of Contact from contact add-on (optional and if available)
+ contact_fname TINYTEXT NULL, -- Contact first name for this location (optional)
+ contact_lname TINYTEXT NULL, -- Contact last name for this location (optional)
+ contact_phone TINYTEXT NULL, -- Contact phone for this location (optional)
+ contact_email TINYTEXT NULL, -- Contact E-Mail address (optional)
+ PRIMARY KEY (id),
+ INDEX(name)
+);
+
+----
+
+-- Events - Base event information - May also be entries here referenced by the "times" table for a custom date.
+CREATE TABLE {prefix}events (
+ id INT NOT NULL AUTO_INCREMENT,
+ status INT NULL, -- Status for this event, see config['status']
+ custom_time INT NULL, -- If this is a custom record for a specific instance (date) this points to that times table entry
+ root_event INT NULL, -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set)
+ created DATETIME NULL, -- Date/Time event was created or date custom event record was created if custom record
+ updated DATETIME NULL, -- Date/Time this event record was last updated
+ approved DATETIME NULL, -- Date/Ttime this event record was approved
+ ref_type INT NULL, -- Type of entity this contact is associated with - See config['ref_type']
+ ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact is associated with
+ hide_address BOOLEAN NULL, -- Option to hide address on front-end
+ featured BOOLEAN NULL, -- Option to mark as featured event
+ slideshow BOOLEAN NULL, -- Option to mark for use in slide show
+ major BOOLEAN NULL, -- Option to mark as a major event
+ name TINYTEXT NULL, -- Name of this event
+ header TINYTEXT NULL, -- Header text for front-end display
+ intro TINYTEXT NULL, -- Intro text for front-end display
+ descr TEXT NULL, -- Full description text
+ image TINYTEXT NULL, -- Image file name
+ url TINYTEXT NULL, -- Event URL
+ cost TINYTEXT NULL, -- Description of event cost
+ notes TEXT NULL, -- Internal notes for this event
+ PRIMARY KEY (id),
+ INDEX(custom_time),
+ INDEX(root_event),
+ INDEX(ref_type),
+ INDEX(ref_dest),
+ INDEX(featured),
+ INDEX(slideshow),
+ INDEX(major),
+ INDEX(name)
+);
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Events DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$glmMembersEventsDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 6)
+);
+
--- /dev/null
+-- Gaslight Media Members Database - Sample
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+
+-- **********************************************************************
+-- NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+--
+-- Please change all references to sample, Sample, or SAMPLE to a name
+-- appropriate for your new Add-On.
+--
+-- Tables and queries in this file are sample only.
+--
+-- Remove this message before using this file in production!
+-- **********************************************************************/
+
+
+-- Sample Table
+CREATE TABLE {prefix}sometablename (
+ id INT NOT NULL AUTO_INCREMENT,
+ somefield TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Sample default entry in table
+INSERT INTO {prefix}sometablename
+ ( id, somefield )
+ VALUES
+ ( 1, 'sample data' )
+;
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Sample DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+
+/**********************************************************************
+ * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+ *
+ * Please change all references to sample, Sample, or SAMPLE to a name
+ * appropriate for your new Add-On.
+ *
+ * This file lists all versions of the database tables for this add-on.
+ * The last entry in the array below should be for the most recent
+ * version and should match the "create_database_V..." file in this
+ * directory.
+ *
+ * NOTE: When first creating a new add-on with database tables, there
+ * should only be one line in the array below and there should be no
+ * "update_database..." files in this directory.
+ *
+ * Remove this message before using this file in production!
+ **********************************************************************/
+
+
+$glmMembersSampleDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 1),
+ '0.0.2' => array('version' => '0.0.2', 'tables' => 2)
+);
+
--- /dev/null
+DATABASE EXAMPLE FILES
+----------------------
+
+*** THESE ARE EXAMPLES ONLY ***
+
+The files in this directory are examples only. Do not use any of these as they are!
+
+The example here is of a set of one table for the add-on that is initially created
+by the create_database_V0.0.1.sql script. That file creates one table and inserts
+one entry into that table.
+
+In this example, the database is later updated by two files. Either of these may
+be included separately if only a PHP file is needed to update the database, or
+just an SQL script. Sometimes both are needed.
+
+There is also an entry in the dbVersions.php file that describes the update.
+
+Note that the number of tables needs to be set to the updated number for each update.
+
+Also note taht the SQL update scripts are run before the PHP update scripts.
+
--- /dev/null
+<?php
+/*
+ * Gaslight Media Members Database - Sample Add-On
+ *
+ * Database Update Script for version 0.0.2
+ */
+
+/**********************************************************************
+ * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+ *
+ * Please change all references to sample, Sample, or SAMPLE to a name
+ * appropriate for your new Add-On.
+ *
+ * This is a sample database update process. There should be an SQL
+ * script for each update in this directory. This php file is optionsl
+ * and can be used to perform more complex data updates.
+ *
+ * If this file exists, it is called after the matching SQL script has
+ * been run.
+ *
+ * ******** THE CODE BELOW IS STICTLY A SAMPLE ********
+ *
+ * Remove this message before using this file in production!
+ **********************************************************************/
+
+/*
+ * Update sample records to take data from one field, change it, then store it in the new field
+ */
+
+// Get all records from the sometablename table.
+$sampleRecords = $this->wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename;', ARRAY_A);
+
+// If there's any records
+if ($sampleRecords && count($sampleRecords) > 0) {
+
+ // For each record
+ foreach ($sampleRecords as $p) {
+
+ // Create a slug from the somefield field
+ $newData = sanitize_title($p['somefield']).'-'.$p['id'];
+
+ // Store this value back into the record in the new yetanotherfield field
+ $this->wpdb->update(
+ GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename',
+ array(
+ 'yetanotherfield' => $slug
+ ),
+ array( 'id' => $p['id'] ),
+ array( '%s' ),
+ array( '%d')
+ );
+ }
+
+}
--- /dev/null
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.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
+
+-- A sample database update script
+CREATE TABLE {prefix}anothertablename (
+ id INT NOT NULL AUTO_INCREMENT,
+ anotherfield TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+ALTER TABLE {prefix}sometablename ADD COLUMN yetanotherfield TINYTEXT;
+
+
+
This directory contains database creation and update scripts for this add-on.
-This directly is optional. If there are no data tables added by this add-on,
-this directory should be omitted.
+The files in this directory are checked by the checkDatabase() function in the
+main plugin classes/glmPluginSupport.php file.
+
+This directory is optional. If there are no data tables that need to be created
+for this add-on, there should be no files in this directory. The directory may
+also be deleted.
+
+See the "examples" directory for a sample of what can go in this directory.