From: Laury GvR Date: Thu, 20 Sep 2018 19:13:01 +0000 (-0400) Subject: Make ref_type and ref_dest variable, passed by the filters, adjusting urls as needed X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=f04539c4c0c5f02a2c96230d338b76402999ca4d;p=WP-Plugins%2Fglm-member-db.git Make ref_type and ref_dest variable, passed by the filters, adjusting urls as needed --- diff --git a/models/admin/newDashboard/index.php b/models/admin/newDashboard/index.php index e7b8f766..baf10ad4 100644 --- a/models/admin/newDashboard/index.php +++ b/models/admin/newDashboard/index.php @@ -248,9 +248,10 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers } public function queryWidgetLists( &$widgetData = false ) { + foreach ( $widgetData as &$widgetComponent ) { - echo "
"; - var_dump($widgetComponent); + //echo "
"; + //var_dump($widgetComponent); if ( $widgetComponent['component'] == 'list' && isset($widgetComponent['fields']) && isset($widgetComponent['table']) ) { if ( isset($widgetComponent['where']) && $widgetComponent['where'] !== "" ) { @@ -261,6 +262,16 @@ class GlmMembersAdmin_newDashboard_index extends GlmDataMembers $resultsQuery = "SELECT " . $widgetComponent['fields'] . " FROM " . $widgetComponent['table'] . " WHERE " . $where . " LIMIT 5;"; $widgetComponent['sql'] = $resultsQuery; $widgetComponent['listItems'] = $this->wpdb->get_results($resultsQuery); + + if ( isset($widgetComponent['listItems']) ) { + foreach ( $widgetComponent['listItems'] as &$listItem ) { + if ( isset($listItem->ref_type) ) { + // Get the ref type from the config array - has to be forced lowercase due to inconsistency + // in url vs config array reference to ref_type (e.g. member vs Member, and member vs members) + $listItem->ref_type = strtolower($this->config['ref_type'][$listItem->ref_type]); + } + } + } $countQuery = "SELECT COUNT(id) FROM " . $widgetComponent['table'] . " WHERE " . $where . ";"; $widgetComponent['count'] = $this->wpdb->get_var($countQuery); diff --git a/views/admin/newDashboard/components/list.html b/views/admin/newDashboard/components/list.html index 42dfb398..f3ac0f9d 100644 --- a/views/admin/newDashboard/components/list.html +++ b/views/admin/newDashboard/components/list.html @@ -1,9 +1,8 @@ -
List component was called
{$widgetField.title} {$widgetField.count}