--- /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_detail
+ *
+ * @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_detail 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) {
+add_filter('glm-member-db-front-members-detail-sidebar', function($content, $id) {
+ $eventData = do_shortcode('[glm-members-fields-detail member='.$id.', template="detail-sidemenu" order="title"]');
+ $content .= $eventData;
+ return $content;
+ },
+ 10,
+ 2
+);
+ add_filter('glm-member-db-front-members-list-info', function($content, $id) {
$eventData = do_shortcode('[glm-members-fields-list member='.$id.', template="detail-sidemenu" order="title"]');
$content .= $eventData;
return $content;