Adding dashboard message field.
This can be displayed within the dashboard.
'use' => 'a'
),
+ // dashboard message
+ 'dashboard_message' => array(
+ 'field' => 'dashboard_message',
+ 'type' => 'text',
+ 'require' => false,
+ 'use' => 'a'
+ ),
+
// message
'message' => array(
'field' => 'message',
* version from this plugin.
*/
define('GLM_MEMBERS_RELAY_PLUGIN_VERSION', '1.0.0');
-define('GLM_MEMBERS_RELAY_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_RELAY_PLUGIN_DB_VERSION', '0.0.2');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_RELAY_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
switch ( $option ) {
case 'add':
$message = $this->newEntry();
- $view = 'edit.html';
+ $view = 'edit.html';
break;
case 'insert':
$_REQUEST['created'] = date( 'Y-m-d H:i:s' );
$_REQUEST['updated'] = date( 'Y-m-d H:i:s' );
- $message = $this->insertEntry();
- $view = 'edit.html';
+ $message = $this->insertEntry();
+ $view = 'edit.html';
break;
case 'edit':
if ( isset( $_REQUEST['id'] ) && $message_id = filter_var( $_REQUEST['id'] ) ) {
break;
case 'update':
if ( isset( $_REQUEST['id'] ) && $message_id = filter_var( $_REQUEST['id'] ) ) {
+
+ // Set the updated time to now
$_REQUEST['updated'] = date( 'Y-m-d H:i:s' );
- $message = $this->updateEntry( $message_id );
+ $message = $this->updateEntry( $message_id );
if ( $message['status'] ) {
$updated = true;
+++ /dev/null
--- Gaslight Media Members Database - Relay Add-On
--- File Created: 2018-06-01
--- Database Version: 0.0.1
--- 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
-
-
--- Messages
-CREATE TABLE {prefix}messages (
- id INT NOT NULL AUTO_INCREMENT,
- status TINYINT(1) NULL, -- Message Status (Active, Inactive etc.)
- title TINYTEXT NULL, -- Title of Message
- message TEXT NULL, -- Message Details
- created DATETIME NOT NULL, -- Created timestamp
- updated DATETIME NOT NULL, -- Updated timestamp
- PRIMARY KEY (id),
- INDEX(updated)
-);
--- /dev/null
+-- Gaslight Media Members Database - Relay Add-On
+-- File Created: 2018-06-01
+-- 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 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
+
+
+-- Messages
+CREATE TABLE {prefix}messages (
+ id INT NOT NULL AUTO_INCREMENT,
+ status TINYINT(1) NULL, -- Message Status (Active, Inactive etc.)
+ title TINYTEXT NULL, -- Title of Message
+ dashboard_message TEXT NULL, -- Dashboard Message
+ message TEXT NULL, -- Message Details
+ created DATETIME NOT NULL, -- Created timestamp
+ updated DATETIME NOT NULL, -- Updated timestamp
+ PRIMARY KEY (id),
+ INDEX(updated)
+);
*/
$glmMembersRelayDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '06/01/2018'),
+ '0.0.2' => array('version' => '0.0.2', 'tables' => 1, 'date' => '08/15/2018'),
);
--- /dev/null
+-- Gaslight Media Members Database - Relay Add-On
+-- File Created: 08/15/18
+-- Database Version: 0.0.2
+-- 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
+
+-- new field in messages
+ALTER TABLE {prefix}messages ADD COLUMN dashboard_message TEXT NULL; -- Dashboard Message
<input type="hidden" name="option" value="insert" />
{/if}
- <table id="glm-table-message" class="glm-admin-table glm-event-table">
+ <table id="glm-table-message" class="glm-admin-table glm-event-table" style="width: 900px;">
<tr>
<th {if $message.fieldRequired.status} class="glm-required"}{/if}>Status</th>
<tr>
<th {if $message.fieldRequired.title} class="glm-required"}{/if}>Title</th>
<td {if $message.fieldFail.title}class="glm-form-bad-input" data-tabid="glm-title"{/if}>
- <input type="text" name="title" value="{$message.fieldData.title}" class="glm-form-text-input-medium">
+ <input type="text" name="title" value="{$message.fieldData.title|escape:'html'}" class="glm-form-text-input-medium">
{if $message.fieldFail.title}<p>{$message.fieldFail.title}</p>{/if}<br>
</td>
</tr>
+ <tr>
+ <th {if $message.fieldRequired.dashboard_message} class="glm-required"}{/if}>Dashboard Message</th>
+ <td {if $message.fieldFail.dashboard_message}class="glm-form-bad-input" data-tabid="glm-dashboard_message"{/if}>
+ {php}
+ wp_editor('{$message.fieldData.dashboard_message|escape:quotes}', 'dashboard_message', array(
+ 'wpautop' => false,
+ 'textarea_name' => 'dashboard_message',
+ 'editor_height' => 200,
+ 'teeny' => true,
+ ));
+ {/php}
+ {if $message.fieldFail.dashboard_message}<p>{$message.fieldFail.dashboard_message}</p>{/if}<br>
+ </td>
+ </tr>
+
<tr>
<th {if $message.fieldRequired.message} class="glm-required"}{/if}>Message</th>
<td {if $message.fieldFail.message}class="glm-form-bad-input" data-tabid="glm-message"{/if}>
{php}
- wp_editor('{$message.fieldData.message|escape:quotes}', 'glm_descr', array(
- 'wpautop' => false,
+ wp_editor('{$message.fieldData.message|escape:quotes}', 'message', array(
+ 'wpautop' => false,
'textarea_name' => 'message',
- 'editor_height' => 400, // Height in px, overrides editor_rows
+ 'editor_height' => 400,
+ 'teeny' => true,
));
{/php}
{if $message.fieldFail.message}<p>{$message.fieldFail.message}</p>{/if}<br>