Coping these from the events and switching the names to Coupon.
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Management
+ *
+ * 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: dataCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataCoupon 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 GlmDataCouponsManagement 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 . 'settings';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Recipient Email
+ 'notify_to' => array(
+ 'field' => 'notify_to',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // Sender Email
+ 'notify_from' => array(
+ 'field' => 'notify_from',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // Email Notification
+ 'notify_message' => array(
+ 'field' => 'notify_message',
+ '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;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Coupons List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ */
+
+// Inform the coupons code that we're working from the member area
+define('GLM_COUPONS_MEMBER_MENU', true);
+
+// Load the coupons index
+require GLM_MEMBERS_COUPONS_PLUGIN_PATH."/models/admin/coupons/list.php";
+
+// Extend the coupons index class
+class GlmMembersAdmin_member_coupons extends GlmMembersAdmin_coupons_list
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Coupon ID
+ *
+ * @var $couponID
+ * @access public
+ */
+ public $couponID = false;
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ /*
+ * Run constructor for the Coupons class
+ */
+ parent::__construct($wpdb, $config);
+
+ }
+
+}
'glm-members-admin-menu-coupons-list', // Menu slug
function() {$this->controller('coupons', 'list');}
);
+
+// 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']) {
+
+ add_submenu_page(
+ $mainMenuSlug,
+ 'Coupons',
+ 'Coupons',
+ 'glm_members_edit_my_entity',
+ 'glm-members-admin-menu-coupons-list',
+ function() {$this->controller('coupons');}
+ );
+
+}
--- /dev/null
+{include file='admin/members/header.html'}
+
+ <h2 class="nav-tab-wrapper">
+ <a href="{$thisURL}?page={$thisPage}&glm_action=add&member={$memberID}" class="nav-tab{if $thisAction==add} nav-tab-active{/if}">Add Coupon</a>
+ <a href="{$thisURL}?page={$thisPage}&glm_action=categories&member={$memberID}" class="nav-tab{if $thisAction==categories} nav-tab-active{/if}">Coupon Categories</a>
+ </h2>
+<div class="wrap">
+ <div id="glm-admin-content-container">
+ <input class="button button-primary glm-button glm-right" type="button" value="Pending Coupons">
+ <input class="button button-primary glm-button glm-right" type="button" value="Archived Coupons">
+ <h2> Coupons </h2>
+ <table class="wp-list-table striped glm-admin-table">
+ <thead>
+ <tr>
+ <th>Coupon Title</th>
+ <th>Category</th>
+ <th>Times</th>
+ <th>Days</th>
+ <th>Start Date</th>
+ <th>End Date</th>
+ <th> </th>
+ </tr>
+ </thead>
+ </div>
+</div>