// group id
'uid' => array (
'field' => 'uid',
- 'type' => 'integer',
+ 'type' => 'text',
'view_only' => false,
'use' => 'a'
),
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Fields Add-on - Management Fields Tab
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release fields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Load Management Fields data abstract
+require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFields.php';
+
+/**
+ * GlmMembersAdmin_management_fields
+ *
+ * PHP version 5
+ *
+ * @category Model
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmMembersAdmin_entity_fields extends GlmDataFieldsCustomFields
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * dbh Postgres database connection
+ *
+ * @var mixed
+ * @access public
+ */
+ public $dbh;
+ /**
+ * settings used for the schema and tablenames
+ *
+ * @var mixed
+ * @access public
+ */
+ public $settings = array();
+ /**
+ * categories
+ *
+ * @var bool
+ * @access public
+ */
+ public $categories = array();
+ public $oldCatMap = array();
+ /**
+ * fields
+ *
+ * @var bool
+ * @access public
+ */
+ public $fields = array();
+ public $image_owner;
+
+ /**
+ * 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 members data class
+ parent::__construct(false, false);
+
+ }
+
+ /**
+ * modelAction
+ *
+ * @param bool $actionData
+ * @access public
+ * @return void
+ */
+ public function modelAction($actionData = false)
+ {
+ $option = false;
+ $customFields = false;
+ $haveCustomFields = false;
+ $customFieldData = false;
+
+ if (isset($_REQUEST['option'])) {
+ $option = $_REQUEST['option'];
+ }
+
+ // Check if a field ID is supplied
+ $id = 0;
+ if (isset($_REQUEST['id'])) {
+ $id = $_REQUEST['id']-0;
+ }
+ $memberId = 0;
+ if (isset($actionData)) {
+ $memberId = $actionData;
+ print_r($actionData);
+ }
+
+ switch ($option) {
+
+ default:
+ // Make sure option is set if default
+ $option = 'list';
+
+ break;
+
+ }
+
+ // Get list of Custom Fields
+ $customFields = $this->getList( null, 'field_order,id' );
+ if ( isset($customFields) && $customFields && count( $customFields ) > 0 ) {
+ $haveCustomFields = true;
+ }
+
+ require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/customFieldPluginSupport.php';
+ $customFieldsData = customFieldsGetFields( $memberId );
+
+ // Compile template data
+ $template_data = array(
+ 'prefix' => 'glm_custom_field',
+ 'customFields' => $customFields,
+ 'customFieldsData' => $customFieldsData,
+ 'fieldTypes' => $this->config['custom_field_types'],
+ 'haveCustomFields' => $haveCustomFields,
+ );
+
+ // Return status, suggested view, and data to controller
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/entity/fields.html',
+ 'data' => $template_data
+ );
+
+
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members DB - Fields Add-on - Management Fields Tab
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @release fields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link http://dev.gaslightmedia.com/
- */
-
-// Load Management Fields data abstract
-require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFields.php';
-
-/**
- * GlmMembersAdmin_management_fields
- *
- * PHP version 5
- *
- * @category Model
- * @package GLM Member DB
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
- * Exp $
- */
-class GlmMembersAdmin_fields_fields extends GlmDataFieldsCustomFields
-{
-
- /**
- * WordPress Database Object
- *
- * @var $wpdb
- * @access public
- */
- public $wpdb;
- /**
- * dbh Postgres database connection
- *
- * @var mixed
- * @access public
- */
- public $dbh;
- /**
- * settings used for the schema and tablenames
- *
- * @var mixed
- * @access public
- */
- public $settings = array();
- /**
- * categories
- *
- * @var bool
- * @access public
- */
- public $categories = array();
- public $oldCatMap = array();
- /**
- * fields
- *
- * @var bool
- * @access public
- */
- public $fields = array();
- public $image_owner;
-
- /**
- * 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 members data class
- parent::__construct(false, false);
-
- }
-
- /**
- * modelAction
- *
- * @param bool $actionData
- * @access public
- * @return void
- */
- public function modelAction($actionData = false)
- {
- $option = false;
- $customFields = false;
- $haveCustomFields = false;
- $customFieldData = false;
-
- if (isset($_REQUEST['option'])) {
- $option = $_REQUEST['option'];
- }
-
- // Check if a field ID is supplied
- $id = 0;
- if (isset($_REQUEST['id'])) {
- $id = $_REQUEST['id']-0;
- }
- $memberId = 0;
- if (isset($actionData)) {
- $memberId = $actionData-0;
- }
-
- switch ($option) {
-
- default:
- // Make sure option is set if default
- $option = 'list';
-
- break;
-
- }
-
- // Get list of Custom Fields
- $customFields = $this->getList( null, 'field_order,id' );
- if ( isset($customFields) && $customFields && count( $customFields ) > 0 ) {
- $haveCustomFields = true;
- }
-
- require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/customFieldPluginSupport.php';
- $customFieldsData = customFieldsGetFields( $memberId );
-
- // Compile template data
- $template_data = array(
- 'prefix' => 'glm_custom_field',
- 'customFields' => $customFields,
- 'customFieldsData' => $customFieldsData,
- 'fieldTypes' => $this->config['custom_field_types'],
- 'haveCustomFields' => $haveCustomFields,
- );
-
- // Return status, suggested view, and data to controller
- return array(
- 'status' => true,
- 'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/fields/fields.html',
- 'data' => $template_data
- );
-
-
- }
-
-}
/**
* Filter returns the html for the form segment
*/
-add_filter( 'glm-members-customfields-form', function( $content, $uid, $id ){
+add_filter( 'glm-members-custom-fields-form', function( $content, $uid, $id ){
unset( $_REQUEST['glm_action'] );
- $content = $this->controller( 'fields', 'fields', array( 'uid' => $uid, 'memberId' => $id ), true );
+ // $content = $this->controller( 'entity', 'fields', array( 'uid' => false, 'memberId' => false ), true );
+ $content = $this->controller( 'entity', 'fields', array('uid'=>$uid, "memberId"=>$id), true );
return $content;
}, 10, 3 );
/**
field_order SMALLINT NOT NULL DEFAULT 0, -- Order for Field
admin_search BOOLEAN NOT NULL DEFAULT '0', -- If the field is added to member list filters.
required BOOLEAN NOT NULL DEFAULT '0', -- If the field is required.
- uid INT NOT NULL, -- id for the series of custom fields associated with an entity
- entity_id INT NOT NULL DEFAULT '0', -- id for the specific field associated with an entity
+ uid TINYTEXT NOT NULL, -- id for the series of custom fields associated with an entity
+ entity_id INT NOT NULL DEFAULT 0, -- id for the specific field associated with an entity
PRIMARY KEY (id),
INDEX(field_name(20))
);
field_id INT NOT NULL DEFAULT 0, -- Field Id
ref_dest INT NOT NULL DEFAULT 0, -- Member Info Id
field_data TEXT NOT NULL DEFAULT '', -- Data for the field
- entity_id INT NOT NULL, -- id for the specific field associated with an entity
+ entity_id INT NOT NULL DEFAULT 0, -- id for the specific field associated with an entity
PRIMARY KEY (id),
INDEX(field_id),
INDEX(ref_dest)
----
-ALTER TABLE {prefix}custom_fields ADD COLUMN uid INT NOT NULL;
+ALTER TABLE {prefix}custom_fields ADD COLUMN uid TINYTEXT NOT NULL DEFAULT '';
----
----
-ALTER TABLE {prefix}custom_fields ADD COLUMN entity_id INT NOT NULL DEFAULT '0';
+ALTER TABLE {prefix}custom_fields ADD COLUMN entity_id INT NOT NULL DEFAULT 0;
'ajax' => array(
'filterSearch' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG,
),
- 'fields' => array(
+ 'entity' => array(
'fields' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG,
),
'management' => array(
--- /dev/null
+<table id="glm-table-custom-fields" class="glm-admin-table glm-hidden glm-table">
+ {foreach $customFields as $field}
+ <tr >
+ <th>{$field.field_name}</th>
+ <td>
+ {if $field.field_type.name == 'text'}
+ <input type="text" name="{$prefix}[{$field.id}]" value="{if isset($customFieldsData[$field.id])}{$customFieldsData[$field.id]|escape}{/if}">
+ {elseif $field.field_type.name == 'textarea'}
+ {php}
+ wp_editor('{if isset($customFieldsData[$field.id])}{$customFieldsData[$field.id]|escape:quotes}{/if}', 'custom-field-{$field.id}', array(
+ 'media_buttons' => false,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => '{$prefix}[{$field.id}]',
+ 'editor_height' => 200, // Height in px, overrides editor_rows
+ // 'textarea_rows' => 8
+ ));
+ {/php}
+ {elseif $field.field_type.name == 'checkbox'}
+ <input type="hidden" name="{$prefix}[{$field.id}]" value="No" {if !isset($customFieldsData[$field.id]) || $customFieldsData[$field.id] == 'No'}checked{/if}>
+ <input type="checkbox" name="{$prefix}[{$field.id}]" value="Yes" {if isset($customFieldsData[$field.id]) && $customFieldsData[$field.id] == 'Yes'}checked{/if}>
+ {/if}
+ </td>
+ </tr>
+ {/foreach}
+</table>
+++ /dev/null
-<table id="glm-table-custom-fields" class="glm-admin-table glm-hidden glm-table">
- {foreach $customFields as $field}
- <tr >
- <th>{$field.field_name}</th>
- <td>
- {if $field.field_type.name == 'text'}
- <input type="text" name="{$prefix}[{$field.id}]" value="{if isset($customFieldsData[$field.id])}{$customFieldsData[$field.id]|escape}{/if}">
- {elseif $field.field_type.name == 'textarea'}
- {php}
- wp_editor('{if isset($customFieldsData[$field.id])}{$customFieldsData[$field.id]|escape:quotes}{/if}', 'custom-field-{$field.id}', array(
- 'media_buttons' => false,
- // 'quicktags' => false,
- // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
- 'textarea_name' => '{$prefix}[{$field.id}]',
- 'editor_height' => 200, // Height in px, overrides editor_rows
- // 'textarea_rows' => 8
- ));
- {/php}
- {elseif $field.field_type.name == 'checkbox'}
- <input type="hidden" name="{$prefix}[{$field.id}]" value="No" {if !isset($customFieldsData[$field.id]) || $customFieldsData[$field.id] == 'No'}checked{/if}>
- <input type="checkbox" name="{$prefix}[{$field.id}]" value="Yes" {if isset($customFieldsData[$field.id]) && $customFieldsData[$field.id] == 'Yes'}checked{/if}>
- {/if}
- </td>
- </tr>
- {/foreach}
-</table>