From 56d414d58cd08dfe8063b1d53dd11b345675a2e2 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Tue, 4 Oct 2016 11:05:07 -0400 Subject: [PATCH] Commented out shortcode override function This function was causing the shortcode to be overridden in the sidebar. The function itself is deprecated and has now been disabled. --- controllers/front.php | 11 ++- models/front/members/featured.php | 141 ++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 models/front/members/featured.php diff --git a/controllers/front.php b/controllers/front.php index 03b8dc1c..7188d39b 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -314,13 +314,20 @@ class glmMembersFront extends GlmPluginSupport $menuItem = $shortcodeData['menu']; $action = $shortcodeData['action']; - // Get any requested "action" from a form submission - Overrides short-code default action + /* Get any requested "action" from a form submission - Overrides short-code default action + * + * This has been commented out because it does not appear to be used + * and was causing the wrong model to be used after a category-based + * search to a page with more than one model.. + */ + /* if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') { $a = sanitize_text_field($_REQUEST['glm_action']); if ($a != '') { $action = $a; } } + */ // Set the default attributes and create a filter to update them $actionData = array( @@ -393,7 +400,7 @@ class glmMembersFront extends GlmPluginSupport } // check for an invalid model class name - if (! class_exists($className)) { + if (! class_exists($className)) { $errorMsg .= "Model class doesn't exist: ".$className; diff --git a/models/front/members/featured.php b/models/front/members/featured.php new file mode 100644 index 00000000..b80834d4 --- /dev/null +++ b/models/front/members/featured.php @@ -0,0 +1,141 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + + +// Load Members data abstract +require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'; + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersFront_members_featured extends GlmDataMemberInfo +{ + + /** + * 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 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. + * + */ + public function modelAction ($actionData = false) + { + $settings = array(); + + $view = "featured"; + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "members + WHERE featured + + ;"; + $id = $this->wpdb->get_var($sql); + $memberData = $this->getActiveInfoForMember($id); + if (count($memberData) > 0) { + $success = true; + } + + // Compile template data + +// echo "
".print_r($memberData,true)."
"; + + $templateData = array( + 'view' => $view, + 'member' => $memberData, + ); + + // Return status, suggested view, and data to controller - also return any modified settings + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => "front/members/featured.html", + 'data' => $templateData, + 'settings' => $settings + ); + + } + + +} + +?> -- 2.17.1