adding section in mgmt for approved and declined email messages, moving the to and from email addresses
out of mgmt and into the settings section with messages. added some styles to the admin section. Fixed the
front end submission form to use the new email sections. updated the database scripts and database versions
file, the plugin version and db version. Added tab , model , action and view to the events plugin for the new
email notification settings table
--- /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 $
+ */
+
+/**
+ * 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 GlmDataEmailNotifications 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 . 'email_notifications';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event Declined Message
+ 'declined_message' => array(
+ 'field' => 'declined_message',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // Event Declined Message
+ 'approved_message' => array(
+ 'field' => 'approved_message',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // To Email address
+ 'to_email' => array(
+ 'field' => 'to_email',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // From Email Address
+ 'from_email' => array(
+ 'field' => 'from_email',
+ 'type' => 'text',
+ '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;
+ }
+}
+
+?>
*/
/*
Created on : 15-Feb-2016, 1:53:23 PM
- Author : anthony
+ Author : Gaslight Media
*/
#occurrences{
display: none;
#startTime, #startDate,#endDate, #endTime{
width: 15%;
}
-//#endDate, #endTime{
-// width: 15%;
-//}
+
#timeZone{
width: 25%;
}
-.titles{
-
+
+/*
+ Email Notification Settings
+*/
+.email-notification-label{
+ font-weight: bold;
+ padding: 0;
+}
+
+@media(min-width: 640px){
+ .email-notification-label:not(.email-address-label){
+ margin-top: 30px;
+ }
+ .email-address-label{
+ margin-top: 5px;
+ }
+}
+.email-notification-editor{
+ padding: 0;
+ margin-bottom: 25px;
}
\ No newline at end of file
* Plugin Name: GLM Members Database Events
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.6.57
+
+ * Version: 1.6.58
+
* Author: Chuck Scott
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseEventsAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.6.57
+
+ * @version 1.6.58
+
*/
// Check that we're being called by WordPress.
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.57');
-define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.2');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.58');
+define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.3');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.9.15');
}
// DECLINED & APPROVED EVENT EMAIL FUNCTIONALITY ///////
- $sql = "SELECT from_email FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "management";
- $from_email = $this->wpdb->get_var($sql);
+ $sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "email_notifications";
+ $email_notifications = !empty($this->wpdb->get_results($sql, ARRAY_A)) ? $this->wpdb->get_results($sql, ARRAY_A)[0] : false;
+ $from_email = $email_notifications ? $email_notifications['from_email'] : false;
// echo '<pre>', print_r($event), '</pre>';
$to_email = (isset($event['fieldData']['admin_email']) ? $event['fieldData']['admin_email'] : '' );
// Send confirmation email, set the content type to allow html by using this filter
add_filter( 'wp_mail_content_type', 'set_content_type' );
- $declined_msg = '';
+ $declined = '';
$current_status = $event['fieldData']['status']['value'];
if($to_email){
$message .= "Event Description: $event_intro<br>";
$message .= "Contact Name: $admin_name<br><br>";
+
if( $old_event_status === '20' && $current_status === '10' ) {
-
$subject = 'Event Approved';
-
- $message .= 'Your event has been approved';
+ $message .= $email_notifications['approved_message'];
wp_mail( $to_email, $subject, $message, $header );
} else if( $old_event_status === '20' && $current_status === '40' ){
-
- // $event_notes = (isset($event['fieldData']['notes']) ? filter_var($event['fieldData']['notes'], FILTER_SANITIZE_STRING) : '' );
- // $offset = "DENIED REASON:";
- // $declined_msg = substr($event_notes, strpos($event_notes, 'DENIED REASON:') + strlen($offset));
- $declined_msg = (isset($_REQUEST['deniedText']) ? filter_var(($_REQUEST['deniedText']), FILTER_SANITIZE_STRING) : '' );
-
+ $declined = $email_notifications['declined_message'];
$subject = 'Event Declined';
- $message .= "Your event has been declined for the following reason(s): $declined_msg";
-
+ $message .= "Your event has been declined for the following reason(s):<br> $declined";
wp_mail( $to_email, $subject, $message, $header );
}
}
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Event Email Notification
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Event Categories data abstract
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEmailNotifications.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_emailNotifications extends GlmDataEmailNotifications
+{
+
+ /**
+ * 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 controller 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)
+ {
+
+ $success = true;
+ $error = false;
+ $enable_members = $this->config['settings']['enable_members'];
+ $email_settings = false;
+
+ $email_settings = $this->getSettings();
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'update':
+ $this->updateEntry($email_settings['id']);
+
+ break;
+ case 'new':
+ $this->insertEntry();
+ break;
+ }
+
+ }
+
+ $email_settings = $this->getSettings();
+ // If we had a fatal error, redirect to the error page
+ if ($error) {
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => 'error',
+ 'modelRedirect' => 'index',
+ 'view' => 'admin/error/index.html',
+ 'data' => false
+ );
+ }
+
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+ glmMembersAdmin::addNotice($categories, 'DataBlock', 'Categories Data');
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'enable_members' => $enable_members,
+ 'email_settings' => $email_settings
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/emailNotifications.html',
+ 'data' => $templateData
+ );
+
+ }
+ private function getSettings(){
+ $sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'email_notifications';
+ $email_settings = $this->wpdb->get_results($sql, ARRAY_A);
+ return !empty($email_settings) ? $email_settings[0] : false;
+ }
+
+}
$admin_name = $this->filterInput( $_REQUEST['admin_name'] );
$admin_org = $this->filterInput( $_REQUEST['admin_org'] );
$adminPhone = $this->filterInput( $_REQUEST['admin_phone'] );
- $adminEmail = $this->filterInput( $_REQUEST['admin_email'] );
+ $userEmail = $this->filterInput( $_REQUEST['admin_email'] );
$contactFirst = $this->filterInput( $_REQUEST['contact_fname'] );
$contactLast = $this->filterInput( $_REQUEST['contact_lname'] );
$place = $this->filterInput( $_REQUEST['place'] );
'contact_phone' => $contactPhone,
'admin_name' => $admin_name,
'admin_phone' => $adminPhone,
- 'admin_email' => $adminEmail,
+ 'admin_email' => $userEmail,
'contact_name' => $contactFirst . " " . $contactLast,
'contact_email' => $contactEmail,
'admin_org' => $admin_org
// $siteName = get_bloginfo('name');
// return $siteName;
// }
-// // Send confirmation email, set the content type to allow html by using this filter
+//
+// // Send confirmation email to the admin, set the content type to allow html by using this filter
+ $sql = "SELECT to_email, from_email FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "email_notifications";
+ $email_addresses = $this->wpdb->get_results($sql, ARRAY_A)[0];
+
add_filter( 'wp_mail_content_type', 'set_content_type' );
$site_name = get_bloginfo('name');
- $to = $to_email;
+ $adminEmail = $email_addresses['to_email'];
+ $fromEmail = $email_addresses['from_email'];
$subject = 'Event Form Submission';
$message = $htmlMessage;
$userBody = $userMessage;
$header[] = "From: $site_name <$fromEmail>";
- $header[] = 'Reply-To:' . $adminEmail;
-
- wp_mail($to, $subject, $message, $header);
-
+ $header[] = 'Reply-To:' . $userEmail;
+
+ wp_mail($adminEmail, $subject, $message, $header);
+
// send a copy to the user submitting the email, using different headers and email template file
$userHeader[] = "From: $site_name <$fromEmail>";
$userHeader[] = 'Reply-To: No-Reply@gaslightmedia.com';
-
- if(wp_mail($adminEmail, $subject, $userBody, $userHeader)){
+
+ if(wp_mail($userEmail, $subject, $userBody, $userHeader)){
} else {
echo "Error: Message Not Sent";
return $addOnTabs;
}
);
+ add_filter('glm-member-db-add-tab-for-settings',
+ function($addOnTabs) {
+ $newTabs = array(
+ array(
+ 'text' => 'Event Email Settings',
+ 'menu' => 'settings',
+ 'action' => 'emailNotifications'
+ ),
+
+ );
+ $addOnTabs = array_merge($addOnTabs, $newTabs);
+ return $addOnTabs;
+ }
+ );
+
add_filter('glm-member-db-add-tab-for-settings',
function($addOnTabs) {
+++ /dev/null
--- Gaslight Media Members Database - Events Add-On
--- File Created: 12/02/15 15:27:15
--- Database Version: 0.1.2
--- Database Creation Script
---
--- This file is called to create a new set of tables for this
--- add-on for the most recent 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
-
-
--- 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
- 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_event (
- id INT NOT NULL AUTO_INCREMENT,
- amenity INT NULL,
- event INT NULL,
- PRIMARY KEY (id),
- INDEX(event)
-);
-
-----
-
--- groups
-CREATE TABLE {prefix}amenity_groups (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NULL, -- Name of the Group
- PRIMARY KEY (id),
- INDEX(name(20))
-);
-
-----
-
--- Amenity Group - Links a specific amenity to groups
-CREATE TABLE {prefix}grouped_amenities (
- id INT NOT NULL AUTO_INCREMENT,
- group_id INT, -- Pointer to the group
- amenity_id INT, -- Pointer to the Amenity
- searchable BOOLEAN DEFAULT '0', -- Flag indicating whether the amenity group will show in the search form
- PRIMARY KEY (id)
-);
-
-----
-
--- 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
- name TINYTEXT NULL, -- Name of this recurrence schedule - used on admin calendar
- start_time TIME NULL, -- Start time of day for event
- start_time_only BOOLEAN NULL, -- Use end of first occurrence flag
- end_time TIME NULL, -- End time of day for event - If less than start time, assume a date boundry
- all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (informational only)
- start_date DATE NULL, -- Starting Date (if all_day is selected) Used instead of start_time
- from_date DATE NULL, -- From Date for recurrences
- to_date DATE NULL, -- To Date for recurrences
- recurring BOOLEAN NULL, -- Flag indicating that event recurs on a schedule rather than all dates
- 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)
- by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month
- day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap)
- last_day_of_month BOOLEAN NULL, -- Last day of the month
- specific_dates TEXT NULL, -- Serialized array of specific dates added to the recurrence
- 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)
- recur_id INT NULL, -- Pointer to recurrence entry
- active BOOLEAN NULL, -- Active flag - normally set but used to temporarily disable 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 referenced 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 abbreviation
- 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)
-);
-
-----
-
--- 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 event is associated with - See config['ref_type']
- ref_dest INT NULL, -- Pointer to the specific entity of ref_type this event 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
- name_slug TINYTEXT NULL, -- Slug for this event
- header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED
- intro TINYTEXT NULL, -- Intro text for front-end display
- descr TEXT NULL, -- Full description text
- image TINYTEXT NULL, -- Image file name
- file1 TINYTEXT NULL, -- File name for a single uploaded file #1
- file1_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #1
- file2 TINYTEXT NULL, -- File name for a single uploaded file #2
- file2_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #2
- file3 TINYTEXT NULL, -- File name for a single uploaded file #3
- file3_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #3
- url TINYTEXT NULL, -- Event URL
- ticket_url TINYTEXT NULL, -- Ticket URL
- registration_url TINYTEXT NULL, -- Registration URL
- cost TINYTEXT NULL, -- Description of event cost
- admin_ref_type INT NULL, -- Type of admin contact if using a member contact
- admin_ref_dest INT NULL, -- Pointer to admin contact record if using a member contact
- admin_name TINYTEXT NULL, -- Admin Contact Name if not using a member contact
- admin_org TINYTEXT NULL, -- Admin Contact Organization if not using a member contact
- admin_email TINYTEXT NULL, -- Admin Contact E-Mail if not using a member contact
- admin_phone TINYTEXT NULL, -- Admin Contact Phone if not using a member contact
- free BOOLEAN NULL, -- Event is Free
- contact_email TINYTEXT NULL, -- Contact E-mail address
- contact_name TINYTEXT NULL, -- Contact name
- contact_phone TINYTEXT NULL, -- Event Phone
- use_member_location BOOLEAN NULL, -- Use location of the member (if provided) rather than location table data
- other_ref_dest INT NULL, -- Set location of the event to another member
- old_event_id INT NULL, -- ID of event from old site for reference
- ical_uid TINYTEXT NULL, -- The ical UID for this event.
- 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)
-);
-
-----
-
--- Event Management Settings
-CREATE TABLE {prefix}management (
- id INT NOT NULL AUTO_INCREMENT,
- canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail
- pdf_logo TINYTEXT NULL, -- Image for the Top of the PDF
- footer_text TINYTEXT NULL, -- Image for the Top of the PDF
- to_email TINYTEXT NULL, -- Email address of the recipient
- from_email TINYTEXT NULL, -- Email address of the sender
- email_notification TEXT NULL, -- Email notification message
- calendar_view TINYTEXT NULL, -- Default calendar view
- event_default_state TINYTEXT NULL, -- Default calendar view
- term_event_amenities_singular TINYTEXT NULL, -- Singular term to use for event amenities
- term_event_amenities_plural TINYTEXT NULL, -- Plural term to use for event amenities
- use_event_amenities BOOLEAN NULL, -- Whether amenities are used at all for events
- use_venue_locations BOOLEAN NULL, -- To use Other members as the location of event
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default event management entry
-INSERT INTO {prefix}management
- ( id, canonical_event_page, term_event_amenities_singular, term_event_amenities_plural )
- VALUES
- ( 1, 'event-detail', 'Amenity', 'Amenities' )
-;
-
-----
-
--- Event iCal Feed imports
-CREATE TABLE {prefix}feed_import (
- id INT NOT NULL AUTO_INCREMENT,
- feed_url TEXT NOT NULL, -- The ical feed url to import
- created DATETIME NULL, -- The date this feed was created
- updated DATETIME NULL, -- Last time this feed was updated
- duration INT NULL, -- The time it took to fetch the feed
- events INT NULL, -- The number of events last fetched
- PRIMARY KEY (id)
-);
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.1.3
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most recent 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
+
+
+-- 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
+ 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_event (
+ id INT NOT NULL AUTO_INCREMENT,
+ amenity INT NULL,
+ event INT NULL,
+ PRIMARY KEY (id),
+ INDEX(event)
+);
+
+----
+
+-- groups
+CREATE TABLE {prefix}amenity_groups (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NULL, -- Name of the Group
+ PRIMARY KEY (id),
+ INDEX(name(20))
+);
+
+----
+
+-- Amenity Group - Links a specific amenity to groups
+CREATE TABLE {prefix}grouped_amenities (
+ id INT NOT NULL AUTO_INCREMENT,
+ group_id INT, -- Pointer to the group
+ amenity_id INT, -- Pointer to the Amenity
+ searchable BOOLEAN DEFAULT '0', -- Flag indicating whether the amenity group will show in the search form
+ PRIMARY KEY (id)
+);
+
+----
+
+-- 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
+ name TINYTEXT NULL, -- Name of this recurrence schedule - used on admin calendar
+ start_time TIME NULL, -- Start time of day for event
+ start_time_only BOOLEAN NULL, -- Use end of first occurrence flag
+ end_time TIME NULL, -- End time of day for event - If less than start time, assume a date boundry
+ all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (informational only)
+ start_date DATE NULL, -- Starting Date (if all_day is selected) Used instead of start_time
+ from_date DATE NULL, -- From Date for recurrences
+ to_date DATE NULL, -- To Date for recurrences
+ recurring BOOLEAN NULL, -- Flag indicating that event recurs on a schedule rather than all dates
+ 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)
+ by_day_of_month BOOLEAN NULL, -- Flag indicating if selecting by days of the month
+ day_of_month INTEGER UNSIGNED NULL, -- Day of the month (bitmap)
+ last_day_of_month BOOLEAN NULL, -- Last day of the month
+ specific_dates TEXT NULL, -- Serialized array of specific dates added to the recurrence
+ 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)
+ recur_id INT NULL, -- Pointer to recurrence entry
+ active BOOLEAN NULL, -- Active flag - normally set but used to temporarily disable 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 referenced 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 abbreviation
+ 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)
+);
+
+----
+
+-- 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 event is associated with - See config['ref_type']
+ ref_dest INT NULL, -- Pointer to the specific entity of ref_type this event 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
+ name_slug TINYTEXT NULL, -- Slug for this event
+ header TINYTEXT NULL, -- Header text for front-end display - NOT CURRENTLY USED
+ intro TINYTEXT NULL, -- Intro text for front-end display
+ descr TEXT NULL, -- Full description text
+ image TINYTEXT NULL, -- Image file name
+ file1 TINYTEXT NULL, -- File name for a single uploaded file #1
+ file1_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #1
+ file2 TINYTEXT NULL, -- File name for a single uploaded file #2
+ file2_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #2
+ file3 TINYTEXT NULL, -- File name for a single uploaded file #3
+ file3_descr TINYTEXT NULL, -- Description for file uploaded in field "file" #3
+ url TINYTEXT NULL, -- Event URL
+ ticket_url TINYTEXT NULL, -- Ticket URL
+ registration_url TINYTEXT NULL, -- Registration URL
+ cost TINYTEXT NULL, -- Description of event cost
+ admin_ref_type INT NULL, -- Type of admin contact if using a member contact
+ admin_ref_dest INT NULL, -- Pointer to admin contact record if using a member contact
+ admin_name TINYTEXT NULL, -- Admin Contact Name if not using a member contact
+ admin_org TINYTEXT NULL, -- Admin Contact Organization if not using a member contact
+ admin_email TINYTEXT NULL, -- Admin Contact E-Mail if not using a member contact
+ admin_phone TINYTEXT NULL, -- Admin Contact Phone if not using a member contact
+ free BOOLEAN NULL, -- Event is Free
+ contact_email TINYTEXT NULL, -- Contact E-mail address
+ contact_name TINYTEXT NULL, -- Contact name
+ contact_phone TINYTEXT NULL, -- Event Phone
+ use_member_location BOOLEAN NULL, -- Use location of the member (if provided) rather than location table data
+ other_ref_dest INT NULL, -- Set location of the event to another member
+ old_event_id INT NULL, -- ID of event from old site for reference
+ ical_uid TINYTEXT NULL, -- The ical UID for this event.
+ 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)
+);
+
+----
+
+-- Event Management Settings
+CREATE TABLE {prefix}management (
+ id INT NOT NULL AUTO_INCREMENT,
+ canonical_event_page TINYTEXT NULL, -- Canonical page slug for event detail
+ pdf_logo TINYTEXT NULL, -- Image for the Top of the PDF
+ footer_text TINYTEXT NULL, -- Image for the Top of the PDF
+ to_email TINYTEXT NULL, -- Email address of the recipient
+ from_email TINYTEXT NULL, -- Email address of the sender
+ email_notification TEXT NULL, -- Email notification message
+ calendar_view TINYTEXT NULL, -- Default calendar view
+ event_default_state TINYTEXT NULL, -- Default calendar view
+ term_event_amenities_singular TINYTEXT NULL, -- Singular term to use for event amenities
+ term_event_amenities_plural TINYTEXT NULL, -- Plural term to use for event amenities
+ use_event_amenities BOOLEAN NULL, -- Whether amenities are used at all for events
+ use_venue_locations BOOLEAN NULL, -- To use Other members as the location of event
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event management entry
+INSERT INTO {prefix}management
+ ( id, canonical_event_page, term_event_amenities_singular, term_event_amenities_plural )
+ VALUES
+ ( 1, 'event-detail', 'Amenity', 'Amenities' )
+;
+
+----
+
+-- Event iCal Feed imports
+CREATE TABLE {prefix}feed_import (
+ id INT NOT NULL AUTO_INCREMENT,
+ feed_url TEXT NOT NULL, -- The ical feed url to import
+ created DATETIME NULL, -- The date this feed was created
+ updated DATETIME NULL, -- Last time this feed was updated
+ duration INT NULL, -- The time it took to fetch the feed
+ events INT NULL, -- The number of events last fetched
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Event Email Notifications
+CREATE TABLE {prefix}email_notifications (
+ id INT NOT NULL AUTO_INCREMENT,
+ declined_message TEXT NULL, -- Event declined message
+ approved_message TEXT NULL, -- Event approved message
+ to_email TINYTEXT NULL, -- To Email Address
+ from_email TINYTEXT NULL, -- From Email Address
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event email settings
+INSERT INTO {prefix}email_notifications
+ ( id, declined_message, approved_message )
+ VALUES
+ ( 1, 'The Event parameters do not comply with our event guidelines.', 'Your event has been approved.' )
+;
\ No newline at end of file
'0.1.0' => array('version' => '0.1.0', 'tables' => 12, 'date' => '10/20/2016'),
'0.1.1' => array('version' => '0.1.1', 'tables' => 12, 'date' => '11/02/2016'),
'0.1.2' => array('version' => '0.1.2', 'tables' => 12, 'date' => '05/03/2017'),
+ '0.1.3' => array('version' => '0.1.3', 'tables' => 13, 'date' => '08/14/2017'),
);
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 2017-08-04
+-- Database Version: 0.1.3
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Event Email Notifications
+CREATE TABLE {prefix}email_notifications (
+ id INT NOT NULL AUTO_INCREMENT,
+ declined_message TEXT NULL, -- Event declined message
+ approved_message TEXT NULL, -- Event approved message
+ to_email TINYTEXT NULL, -- To Email Address
+ from_email TINYTEXT NULL, -- From Email Address
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event email settings
+INSERT INTO {prefix}email_notifications
+ ( id, declined_message, approved_message )
+ VALUES
+ ( 1, 'The Event parameters do not comply with our event guidelines.', 'Your event has been approved.' )
+;
\ No newline at end of file
'settings' => array(
'eventCategories' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
'eventAmenities' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
+ 'emailNotifications' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG,
),
'management' => array(
'events' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG
});
// declined event dialog
- (function(){
- var notes = $('[name="notes"');
- var reason = $("#deniedText");
-
- $('[name="status"]').on("change", function(){
- var status = $(this).val();
- if(status === '40'){
- $("#deniedReason").dialog("open");
- }
- });
- $("#deniedReasonSubmit").on("click", function(){
-
- var reason_text = reason.val();
-
- if(reason_text){
- $("#deniedReason").dialog("close");
- var content = " DENIED REASON: " + reason_text;
- var current_notes = notes.val();
- notes.append(" DENIED REASON: " + reason_text);
- notes.val(current_notes + content);
- $('#declinedMsg').val(reason_text);
- } else {
- reason.next().css("display", "block");
- }
- });
- })();
+// (function(){
+// var notes = $('[name="notes"');
+// var reason = $("#deniedText");
+//
+// $('[name="status"]').on("change", function(){
+// var status = $(this).val();
+// if(status === '40'){
+// $("#deniedReason").dialog("open");
+// }
+// });
+// $("#deniedReasonSubmit").on("click", function(){
+//
+// var reason_text = reason.val();
+//
+// if(reason_text){
+// $("#deniedReason").dialog("close");
+// var content = " DENIED REASON: " + reason_text;
+// var current_notes = notes.val();
+// notes.append(" DENIED REASON: " + reason_text);
+// notes.val(current_notes + content);
+// $('#declinedMsg').val(reason_text);
+// } else {
+// reason.next().css("display", "block");
+// }
+// });
+// })();
});
</script>
--- /dev/null
+{include file='admin/settings/header.html'}
+ <!-- Add Categories Button and Dialog Box -->
+
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="emailNotifications">
+ {if $email_settings}
+ <input type="hidden" name="option" value="update">
+ {else if}
+ <input type="hidden" name="option" value="new">
+ {/if}
+ <div class="glm-row">
+ <div class="glm-small-12 glm-medium-3 glm-column email-notification-label"> Declined Message </div>
+ <div class="glm-small-12 glm-medium-9 glm-column email-notification-editor">
+ {php}
+ wp_editor('{if $email_settings} {$email_settings.declined_message|escape:quotes} {/if}', 'glm_declined', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'declined_message',
+ 'editor_height' => 300, // Height in px, overrides editor_rows
+ // 'textarea_rows' => 8
+ ));
+ {/php}
+ </div>
+ </div>
+ <div class="glm-row">
+ <div class="glm-small-12 glm-medium-3 glm-columns email-notification-label"> Approved Message </div>
+ <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+ {php}
+ wp_editor('{if $email_settings} {$email_settings.approved_message|escape:quotes} {/if}', 'glm_approved', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'approved_message',
+ 'editor_height' => 300, // Height in px, overrides editor_rows
+ // 'textarea_rows' => 8
+ ));
+ {/php}
+ </div>
+ </div>
+ <div class="glm-row">
+ <div class="glm-small-12 glm-medium-3 glm-columns email-notification-label email-address-label">To Address </div>
+ <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+ <input class="glm-form-text-input-medium" name="to_email" id="fromEmailAddress" type="text" value="{$email_settings.to_email}">
+ </div>
+ <div class="glm-small-12 glm-medium-3 glm-columns email-notification-label email-address-label"> From Address </div>
+ <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+ <input class="glm-form-text-input-medium" name="from_email" id="fromEmailAddress" type="text" value="{$email_settings.from_email}">
+ </div>
+ </div>
+ <input type="submit" value="Update Settings" class="button-primary">
+ </form>
+
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ });
+ </script>
+{include file='admin/footer.html'}