--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Coupon Member Notification
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license http://www.galightmedia.com Gaslightmedia
+ * @release 1
+ */
+
+// Load the Member Data class
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php';
+
+// Extend the member class
+class GlmMembersAdmin_coupon_notification extends GlmDataMembers
+{
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This constructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successful and false if there was a fatal failure.
+ *
+ * '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.
+ *
+ * @wpdb object Word Press 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);
+ }
+
+
+ /**
+ * Send the member a notice
+ */
+ public function sendMemberNotice()
+ {
+
+ }
+
+ /**
+ * Send the admin user a notice
+ */
+ public function sendAdminNotice( $memberId )
+ {
+ echo '<pre>$memberId: ' . print_r( $memberId, true ) . '</pre>';
+ $member = $this->getEntry( $memberId );
+ echo '<pre>$member: ' . print_r( $member, true ) . '</pre>';
+ $settings = $this->config['settings'];
+ $notify_to = $settings['notify_to'];
+ $notify_from = $settings['notify_from'];
+ $notify_message = $settings['notify_message'];
+ }
+}
$namesList = false;
$enable_members = $this->config['settings']['enable_members'];
+ include_once GLM_MEMBERS_COUPONS_PLUGIN_CLASS_PATH . '/helper/notification.php';
+ $notification = new GlmMembersAdmin_coupon_notification( $this->wpdb, $this->config );
+
// Check if there's a logged in user who is locked to their own entity
$lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
if ($lockedToMember) {
break;
case 'update':
+ // test conditions for sending out notice need to be setup here
+ // True if the member is editing the record and the status
+ // turns to pending
+ if ( isset( $_REQUEST['ref_dest'] ) && $member_id = filter_var( $_REQUEST['ref_dest']) ) {
+ $notification->sendAdminNotice( $member_id );
+ }
// Get the original Coupon Status. Before the update.
$old_coupon_status = $this->wpdb->get_var(
$this->wpdb->prepare(