This is to hide the coupons from user member only section if turned off.
'use' => 'a',
),
+ // Allow Members
+ 'allow_member_coupons' => array(
+ 'field' => 'allow_member_coupons',
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'use' => 'a',
+ ),
+
);
}
* version from this plugin.
*/
define('GLM_MEMBERS_COUPONS_PLUGIN_VERSION', '1.0.1');
-define('GLM_MEMBERS_COUPONS_PLUGIN_DB_VERSION', '0.0.3');
+/**
+ * Database Version
+ */
+define('GLM_MEMBERS_COUPONS_PLUGIN_DB_VERSION', '0.0.4');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_COUPONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
);
// If a contact is logged in (ownEntity isn't false), add Contact Profile menu item
-if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) {
+if ( isset( $this->config['loggedInUser'] )
+ && isset( $this->config['loggedInUser']['contactUser'] ) && $this->config['loggedInUser']['contactUser']
+ && $this->config['settings']['allow_member_coupons']
+) {
add_submenu_page(
$mainMenuSlug,
+++ /dev/null
--- Gaslight Media Members Database - Coupons Add-On
--- File Created: 11/15/16
--- Database Version: 0.0.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
-
-
--- Coupons
-CREATE TABLE {prefix}coupons (
- id INT NOT NULL AUTO_INCREMENT,
- status INT NULL, -- Status of the Coupon (Active Pending)
- created DATETIME NULL, -- Create date
- updated DATETIME NULL, -- Update date
- approved DATETIME NULL, -- Approved date
- start_date DATE NULL, -- Starting date of the coupon
- end_date DATE NULL, -- Ending date of the coupon
- expire DATE NULL, -- Expire date of the coupon
- name TINYTEXT NULL, -- Coupon name
- name_slug TINYTEXT NULL, -- Coupon name slug
- ref_type INT NULL, -- Ref type
- ref_dest INT NULL, -- Id from ref type table
- descr TEXT NULL, -- Description of the coupon
- image TINYTEXT NULL, -- Coupon image
- url TINYTEXT NULL, -- website of the coupon
- PRIMARY KEY(id),
- INDEX(ref_type),
- INDEX(ref_dest),
- INDEX(start_date),
- INDEX(end_date)
-);
-
-----
-
--- Categories
-CREATE TABLE {prefix}categories (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NULL, -- Category Name
- PRIMARY KEY (id),
- INDEX(name(20))
-);
-
-----
-
--- Coupon-Category - Categories for specific coupon records
-CREATE TABLE {prefix}coupon_categories (
- id INT NOT NULL AUTO_INCREMENT,
- coupon INT NULL, -- Pointer to the coupon
- category INT NULL, -- Pointer to the category
- PRIMARY KEY (id),
- INDEX(coupon),
- INDEX(category)
-);
-
-----
-
--- Settings
-CREATE TABLE {prefix}management (
- id INT NOT NULL AUTO_INCREMENT,
- notify_to TINYTEXT NULL, -- To for the notify email
- notify_from TINYTEXT NULL, -- From header for notify email
- notify_message TEXT NULL, -- Message to add to the notify email
- default_date_range TINYTEXT NULL, -- Default span for start and end dates
- ribbon_text TEXT NULL, -- Text for the Coupon ribbon on the list and grid views
- PRIMARY KEY (id)
-);
-
-----
-
--- Data for Settings
-INSERT INTO {prefix}management
-(id,notify_to,notify_from,notify_message,default_date_range,ribbon_text)
-VALUES
-(1, '', '', '','6 months','Savings Coupon');
--- /dev/null
+-- Gaslight Media Members Database - Coupons Add-On
+-- File Created: 11/15/16
+-- Database Version: 0.0.4
+-- 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
+
+
+-- Coupons
+CREATE TABLE {prefix}coupons (
+ id INT NOT NULL AUTO_INCREMENT,
+ status INT NULL, -- Status of the Coupon (Active Pending)
+ created DATETIME NULL, -- Create date
+ updated DATETIME NULL, -- Update date
+ approved DATETIME NULL, -- Approved date
+ start_date DATE NULL, -- Starting date of the coupon
+ end_date DATE NULL, -- Ending date of the coupon
+ expire DATE NULL, -- Expire date of the coupon
+ name TINYTEXT NULL, -- Coupon name
+ name_slug TINYTEXT NULL, -- Coupon name slug
+ ref_type INT NULL, -- Ref type
+ ref_dest INT NULL, -- Id from ref type table
+ descr TEXT NULL, -- Description of the coupon
+ image TINYTEXT NULL, -- Coupon image
+ url TINYTEXT NULL, -- website of the coupon
+ PRIMARY KEY(id),
+ INDEX(ref_type),
+ INDEX(ref_dest),
+ INDEX(start_date),
+ INDEX(end_date)
+);
+
+----
+
+-- Categories
+CREATE TABLE {prefix}categories (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NULL, -- Category Name
+ PRIMARY KEY (id),
+ INDEX(name(20))
+);
+
+----
+
+-- Coupon-Category - Categories for specific coupon records
+CREATE TABLE {prefix}coupon_categories (
+ id INT NOT NULL AUTO_INCREMENT,
+ coupon INT NULL, -- Pointer to the coupon
+ category INT NULL, -- Pointer to the category
+ PRIMARY KEY (id),
+ INDEX(coupon),
+ INDEX(category)
+);
+
+----
+
+-- Settings
+CREATE TABLE {prefix}management (
+ id INT NOT NULL AUTO_INCREMENT,
+ notify_to TINYTEXT NULL, -- To for the notify email
+ notify_from TINYTEXT NULL, -- From header for notify email
+ notify_message TEXT NULL, -- Message to add to the notify email
+ default_date_range TINYTEXT NULL, -- Default span for start and end dates
+ ribbon_text TEXT NULL, -- Text for the Coupon ribbon on the list and grid views
+ allow_member_coupons BOOLEAN DEFAULT true, -- Allow Members to add Coupons
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Data for Settings
+INSERT INTO {prefix}management
+(id,notify_to,notify_from,notify_message,default_date_range,ribbon_text,allow_member_coupons)
+VALUES
+(1, '', '', '','6 months','Savings Coupon', true);
'0.0.1' => array('version' => '0.0.1', 'tables' => 3),
'0.0.2' => array('version' => '0.0.2', 'tables' => 4),
'0.0.3' => array('version' => '0.0.3', 'tables' => 4),
+ '0.0.4' => array('version' => '0.0.4', 'tables' => 4),
);
--- /dev/null
+-- Gaslight Media Members Database - Coupons Add-On
+-- File Created: 7/10/19
+-- Database Version: 0.0.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 dashes
+
+
+-- Coupon-Category - CategorieAllow Members to add Coupons
+ALTER TABLE {prefix}management ADD COLUMN allow_member_coupons BOOLEAN DEFAULT true;
+
+
+----
+
+-- Update the management record
+UPDATE {prefix}management SET allow_member_coupons = true;
{if $couponsSettings.fieldFail.ribbon_text}<p>{$couponsSettings.fieldFail.ribbon_text}</p>{/if}
</td>
</tr>
+ <tr>
+ <td colspan="2" {if $couponsSettings.fieldFail.allow_member_coupons}class="glm-form-bad-input glm-form-bad-input-misc"{/if}>
+ <input type="checkbox" id="allow_member_coupons" name="allow_member_coupons" {if $couponsSettings.fieldData.allow_member_coupons.value}checked{/if }>
+ <label for="allow_member_coupons" {if $couponsSettings.fieldRequired.allow_member_coupons}class="glm-required"{/if}>Allow Members:</label>
+ {if $couponsSettings.fieldFail.allow_member_coupons}<p>{$couponsSettings.fieldFail.allow_member_coupons}</p>{/if}
+ </td>
+ </tr>
<tr>
<td>
<h1> E-Mail Notification Settings </h1>