--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Fields
+ *
+ * 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: dataFields.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 GlmDataFieldsCustomFieldsData 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_FIELDS_PLUGIN_DB_PREFIX . 'custom_field_data';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array (
+
+ 'id' => array (
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a'
+ ),
+
+ // Event ID
+ 'field_id' => array(
+ 'field' => 'field_id',
+ 'type' => 'integer',
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ 'ref_dest' => array (
+ 'field' => 'ref_dest',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
+ 'p_field' => 'name',
+ 'p_orderby' => 'name',
+ 'p_blank' => true,
+ 'use' => 'a'
+ ),
+ 'field_data' => array(
+ 'field' => 'field_data',
+ 'type' => 'text',
+ 'required' => true,
+ '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
+/**
+ * list.php
+ *
+ * This is the Members Fields Plugin model for the front list shortcode.
+ * Handles the default and searching of the fields. Then calls appropriate view
+ * files.
+ */
+require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/data/dataCustomFields.php';
+require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/data/dataCustomFieldsData.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMemberInfo.php';
+
+/**
+ * GlmMembersFront_fields_list
+ *
+ * @uses GlmDataFields
+ * @package GlmMemberFields
+ * @version 0.0.1
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
+class GlmMembersFront_fields_list extends GlmDataFieldsCustomFields
+{
+
+ /**
+ * modelAction
+ *
+ * @param bool $actionData Action Data passed to the modelAction
+ *
+ * @access public
+ * @return void
+ */
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ public function modelAction( $actionData = false )
+ {
+ $member_id = null;
+ $where = '';
+ $order = '';
+ $field_vals = '';
+ $slash_price = false;
+
+ global $wpdb;
+
+ // get the member id to pass to getList, set the where clause
+ if ( isset( $actionData['request']['member'] ) ) {
+ $member_id = $actionData['request']['member'] - 0;
+ $member_info = new GlmDataMemberInfo($this->wpdb, $this->config);
+ $member_info_id = $member_info->getActiveInfoIdForMember($member_id);
+ $where = "ref_dest = $member_info_id";
+
+ $fields_data = new GlmDataFieldsCustomFieldsData($this->wpdb, $this->config);
+ $field_values = $fields_data->getList($where);
+
+ foreach($field_values as $key=>$value){
+ $field_id = $value['field_id'];
+ $field_value = $value['field_data'];
+ $sql = "SELECT field_name FROM " . GLM_MEMBERS_FIELDS_PLUGIN_DB_PREFIX . "custom_fields WHERE id = $field_id;";
+ $field_name = $wpdb->get_results($sql);
+ $field_name = $field_name[0]->field_name;
+
+ if( $field_value ){
+ $fields[$field_name] = $field_value;
+ } else if( $field_value === 'Yes'){
+ $slash_price = true;
+ }
+ }
+ }
+
+ // Compile template data
+ $templateData = array(
+ 'field_values' => $fields,
+ 'slash'
+ );
+ error_reporting(E_ALL ^ E_NOTICE);
+ return array(
+ 'status' => $status,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/fields/list.html',
+ 'data' => $templateData,
+ 'settings' => $settings
+ );
+ }
+
+ public function cleanText($text){
+ $text = str_replace(' ', ' ', $text);
+ $text = str_replace('–', '-', $text);
+ $text = str_replace(''', "'", $text);
+ $text = str_replace("\n", ' ', $text);
+ $text = str_replace("\r", '', $text);
+ return $text;
+ }
+}
+
*
* *** Also note that parameters will be in the context of the main front controller constructor. ***
*/
+add_filter('glm-member-db-front-members-detail-descriptionAfter', function($content, $id) {
+ $eventData = do_shortcode('[glm-members-fields-list member='.$id.', template="detail-sidemenu" order="title"]');
+ $content .= $eventData;
+ return $content;
+ },
+ 10,
+ 2
+);
\ No newline at end of file
*/
$glmMembersFieldsShortcodes = array(
+ 'glm-members-fields-list' => array(
+ 'plugin' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG,
+ 'menu' => 'fields',
+ 'action' => 'list',
+ 'table' => false,
+ 'attributes' => array(
+ 'type' => 'all',
+ 'order' => 'title',
+ 'member' => false,
+ 'template' => false,
+ 'limit' => null,
+ 'featured' => null,
+ 'current' => null,
+ )
+ ),
);
$glmMembersFieldsShortcodesDescription = '';
),
),
'frontActions' => array(
+ 'fields' => array(
+ 'list' => GLM_MEMBERS_FIELDS_PLUGIN_SLUG,
+ ),
)
);
--- /dev/null
+{foreach $field_values as $key=>$value}
+<div class="glm-row field-container">
+ {if $value !== 'Yes'}
+ <div class="glm-small-6 glm-columns field-name">{$key}</div>
+
+ <div class="glm-small-6 glm-columns field-value">{$value}</div>
+ {/if}
+
+</div>
+{/foreach}