--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Jobs
+ *
+ * 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 GlmDataEmailJobsNotifications 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_JOBS_PLUGIN_DB_PREFIX . 'email_notifications';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Email Notification Message
+ 'job_email_notification' => array(
+ 'field' => 'job_email_notification',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // Event Declined Message
+ 'job_declined_message' => array(
+ 'field' => 'job_declined_message',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // Event Declined Message
+ 'job_approved_message' => array(
+ 'field' => 'job_approved_message',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // To Email address
+ 'job_to_email' => array(
+ 'field' => 'job_to_email',
+ 'type' => 'text',
+ 'required' => false,
+ 'use' => 'a'
+ ),
+ // From Email Address
+ 'job_from_email' => array(
+ 'field' => 'job_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;
+ }
+}
+
+?>
$member = $this->getEntry( $memberId );
// find notify_to
// See if there's a primary member contact for this member
- $notify_to = apply_filters( 'glm-member-db-admin-get-member-primary-email', '', $memberId );
+ $notify_to = $settings['job_to_email'];
if ( !$notify_to ) {
return false;
}
$memberInfo = $memberInfoData->getActiveInfoForMember( $memberId );
// get settings
$settings = $this->config['settings'];
- $notify_from = $settings['from_email'];
+ $notify_from = $settings['job_from_email'];
// Setup the Smarty Engine
$smarty = new smartyTemplateSupport();
{
$member = $this->getEntry( $memberId );
$settings = $this->config['settings'];
- $notify_to = $settings['to_email'];
- $notify_from = $settings['from_email'];
+ $notify_to = $settings['job_to_email'];
+ $notify_from = $settings['job_from_email'];
$notify_message = $settings['email_notification'];
if ( !$notify_to ) {
return false;
* version from this plugin.
*/
define('GLM_MEMBERS_JOBS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION', '0.0.2');
+define('GLM_MEMBERS_JOBS_PLUGIN_DB_VERSION', '0.0.3');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_JOBS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
$glmMembersjobsManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
unset($glmMembersjobsManagementSettings['id']);
*/
+// Load Events Management Settings data
+
+// Grab the new email_notification to_email and from_email to add to these (override)
+$emailNotifications = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX."email_notifications WHERE id = 1", ARRAY_A );
+if ( $emailNotifications ) {
+ $jobsSettings = $emailNotifications ;
+}
function glmMembersjobsRegisterAddOn($addOns) {
'slug' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
'actions' => $GLOBALS['glmMembersjobsAddOnValidActions'],
'config' => array(
+ 'settings' => $GLOBALS['jobsSettings']
),
'shortcodes' => $GLOBALS['glmMembersjobsShortcodes'],
'shortcodesDescription' => $GLOBALS['glmMembersjobsShortcodesDescription']
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Jobs 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_JOBS_PLUGIN_CLASS_PATH.'/data/dataEmailJobsNotifications.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_emailJobsNotifications extends GlmDataEmailJobsNotifications
+{
+
+ /**
+ * 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;
+
+ $jobs_email_settings = $this->getSettings();
+
+ // If there's an action option
+ if (isset($_REQUEST['option'])) {
+
+ switch($_REQUEST['option']) {
+
+ case 'update':
+ $this->updateEntry($jobs_email_settings['id']);
+
+ break;
+ case 'new':
+ $this->insertEntry();
+ break;
+ }
+
+ }
+
+ $jobs_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
+ );
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'enable_members' => $enable_members,
+ 'email_settings' => $jobs_email_settings
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/settings/emailJobsNotifications.html',
+ 'data' => $templateData
+ );
+
+ }
+ private function getSettings(){
+ $sql = "SELECT * FROM " . GLM_MEMBERS_JOBS_PLUGIN_DB_PREFIX . 'email_notifications';
+ $jobs_email_settings = $this->wpdb->get_results($sql, ARRAY_A);
+ return !empty($jobs_email_settings) ? $jobs_email_settings[0] : false;
+ }
+
+}
);
}
+ if (apply_filters('glm_members_permit_admin_members_jobTitles_tab', true)) {
+ add_filter('glm-member-db-add-tab-for-settings',
+ function($addOnTabs) {
+ $newTabs = array(
+ array(
+ 'text' => 'Jobs Notifications',
+ 'menu' => 'settings',
+ 'action' => 'emailJobsNotifications'
+ ),
+
+ );
+ $addOnTabs = array_merge($addOnTabs, $newTabs);
+ return $addOnTabs;
+ }
+ );
+ }
if (apply_filters('glm_members_permit_admin_members_management_tab', true)) {
add_filter('glm-member-db-add-tab-for-management',
+++ /dev/null
--- Gaslight Media Members Database - Job Postings
--- File Created: 11/20/17 15:27:15
--- Database Version: 0.0.2
--- 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
-
--- Conditions Table
-CREATE TABLE {prefix}jobs (
- id INT NOT NULL AUTO_INCREMENT,
- old_id int NULL ,
- title int NULL ,
- descr TEXT NULL ,
- salary TINYTEXT NULL ,
- email_location TINYTEXT NULL ,
- resume_location TINYTEXT NULL ,
- contact_name TINYTEXT NULL ,
- contact_phone TINYTEXT NULL ,
- post_date DATETIME NULL,
- updated DATETIME NULL,
- active BOOL NULL,
- facility_operation TEXT NULL,
- requirements TEXT NULL,
- benefits TEXT NULL ,
- job_location TINYTEXT NULL ,
- job_expiration INT NULL,
- duration TINYTEXT NULL ,
- deadline TINYTEXT NULL ,
- company TINYTEXT NULL ,
- repost TINYTEXT NULL ,
- position_available TINYTEXT NULL ,
- member INT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Job Titles
-CREATE TABLE {prefix}job_titles (
- id INT NOT NULL AUTO_INCREMENT,
- old_id INT NULL,
- job_title TINYTEXT NULL ,
- PRIMARY KEY (id)
-);
-
-----
-
--- Job Titles default entries in table
--- INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES
--- (1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor');
-
-----
-
--- Job Titles default entries in table
--- INSERT INTO {prefix}jobs (
--- id,old_id,title,descr,salary, email_location,resume_location,contact_name,contact_phone,post_date,updated,visible,
--- facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available,
--- company,member,benefits
--- ) VALUES ( 1,1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'RESUME LOCATION','CONTACT NAME', '453-3443', NOW(),NOW(), true,
--- 'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE',
--- 'COMPANY', 1, 'JOB BENEFITS'
--- );
\ No newline at end of file
--- /dev/null
+-- Gaslight Media Members Database - Job Postings
+-- File Created: 11/20/17 15:27:15
+-- Database Version: 0.0.2
+-- 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
+
+-- Conditions Table
+CREATE TABLE {prefix}jobs (
+ id INT NOT NULL AUTO_INCREMENT,
+ old_id int NULL ,
+ title int NULL ,
+ descr TEXT NULL ,
+ salary TINYTEXT NULL ,
+ email_location TINYTEXT NULL ,
+ resume_location TINYTEXT NULL ,
+ contact_name TINYTEXT NULL ,
+ contact_phone TINYTEXT NULL ,
+ post_date DATETIME NULL,
+ updated DATETIME NULL,
+ active BOOL NULL,
+ facility_operation TEXT NULL,
+ requirements TEXT NULL,
+ benefits TEXT NULL ,
+ job_location TINYTEXT NULL ,
+ job_expiration INT NULL,
+ duration TINYTEXT NULL ,
+ deadline TINYTEXT NULL ,
+ company TINYTEXT NULL ,
+ repost TINYTEXT NULL ,
+ position_available TINYTEXT NULL ,
+ member INT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Job Titles
+CREATE TABLE {prefix}job_titles (
+ id INT NOT NULL AUTO_INCREMENT,
+ old_id INT NULL,
+ job_title TINYTEXT NULL ,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Event Email Notifications
+CREATE TABLE {prefix}email_notifications (
+ id INT NOT NULL AUTO_INCREMENT,
+ job_declined_message TEXT NULL, -- Event declined message
+ job_approved_message TEXT NULL, -- Event approved message
+ job_to_email TINYTEXT NULL, -- To Email Address
+ job_from_email TINYTEXT NULL, -- From Email Address
+ job_email_notification TEXT NULL, -- Email notification message
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event email settings
+INSERT INTO {prefix}email_notifications
+ ( id, job_declined_message, job_approved_message )
+ VALUES
+ ( 1, 'The Job parameters do not comply with our event guidelines.', 'Your Job has been approved.' )
+;
+
+----
+
+-- Job Titles default entries in table
+-- INSERT INTO {prefix}job_titles ( id,old_id,job_title) VALUES
+-- (1,1, 'Supervisor'),(2,1,'Groundskeeper'),(3,1,'Janitor');
+
+----
+
+-- Job Titles default entries in table
+-- INSERT INTO {prefix}jobs (
+-- id,old_id,title,descr,salary, email_location,resume_location,contact_name,contact_phone,post_date,updated,visible,
+-- facility_operation,requirements,job_location,job_expiration,duration,deadline,position_available,
+-- company,member,benefits
+-- ) VALUES ( 1,1, 1,"DESCRIPTION",'SALARY', 'EMAIL LOCATION', 'RESUME LOCATION','CONTACT NAME', '453-3443', NOW(),NOW(), true,
+-- 'facility operations', 'REQUIREMENTS', 'JOB LOCATION', 30, 'JOB DURATION', 'DEADLINE', 'POSITION AVAILABLE',
+-- 'COMPANY', 1, 'JOB BENEFITS'
+-- );
\ No newline at end of file
$glmMembersjobsDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 2, 'date' => '09/08/2017'),
'0.0.2' => array('version' => '0.0.2', 'tables' => 2, 'date' => '11/21/2017'),
+ '0.0.3' => array('version' => '0.0.3', 'tables' => 3, 'date' => '12/21/2017'),
);
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 2017-08-04
+-- Database Version: 0.0.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,
+ job_declined_message TEXT NULL, -- Event declined message
+ job_approved_message TEXT NULL, -- Event approved message
+ job_to_email TINYTEXT NULL, -- To Email Address
+ job_from_email TINYTEXT NULL, -- From Email Address
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event email settings
+INSERT INTO {prefix}email_notifications
+ ( id, job_declined_message, job_approved_message )
+ VALUES
+ ( 1, 'The Job parameters do not comply with our event guidelines.', 'Your Job has been approved.' )
+;
\ No newline at end of file
),
'settings' => array(
'jobTitles' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
+ 'emailJobsNotifications' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
),
'management' => array(
'jobsImport' => GLM_MEMBERS_JOBS_PLUGIN_SLUG,
--- /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="emailJobsNotifications">
+ {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-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-long" name="job_to_email" id="job_toEmailAddress" type="text" value="{$email_settings.job_to_email}">
+ <div class="email-notification-info">Add email address(es) of persons that should receive Event Submission notifications. You can add multiple email addresses, with commas separating each address. Example: info@domain.com,sales@domain.com,email@domain.com</div>
+ </div>
+ <div class="glm-small-12 glm-medium-3 glm-columns email-notification-label email-address-label"> From / Reply To: Address </div>
+ <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+ <input class="glm-form-text-input-medium-long" name="job_from_email" id="job_fromEmailAddress" type="text" value="{$email_settings.job_from_email}">
+ <div class="email-notification-info">This email address is what recipient will receive from the accept/decline email message that is automatically sent once action has been taken on event record.</div>
+ </div>
+ </div>
+ <div class="glm-row">
+ <div class="glm-small-12 glm-medium-3 glm-column email-notification-label"> Email Notification Message </div>
+ <div class="glm-small-12 glm-medium-9 glm-column email-notification-editor">
+ {php}
+ wp_editor('{if $email_settings} {$email_settings.job_email_notification|escape:quotes} {/if}', 'glm_job_notification', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'job_email_notification',
+ '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-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.job_declined_message|escape:quotes} {/if}', 'glm_job_declined', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'job_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.job_approved_message|escape:quotes} {/if}', 'glm_job_approved', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'job_approved_message',
+ 'editor_height' => 300, // Height in px, overrides editor_rows
+ // 'textarea_rows' => 8
+ ));
+ {/php}
+ </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'}