$textSearch = '';
$blankStart = false;
$membersFound = false;
+ $catSearchSelected = false;
// Check for URL parameter override of shortcode parameters
if (isset($_REQUEST['categorySearch'])) {
$textSearch = stripslashes($textSearch);
}
- // Get category data for search pick list and shortcode selection
+ // Get all category data for possible user in search pick list
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
$Categories = new GlmDataCategories($this->wpdb, $this->config);
$categoryData = $Categories->getListSortedParentChild(false);
- // Get any numeric categories selected in the submitted shortcode
+ // Get any numeric categories selected in the submitted shortcode and add to $cats array.
+ // This sets categories that are available for selection by the user
$catSelected = '';
$cats = array();
if (isset($actionData['request']['category'])) {
}
- // Get any text categories selected in the submitted shortcode
+ // Get any text categories selected in the submitted shortcode and add to $cats array
+ // This sets categories that are available for selection by the user.
if (isset($actionData['request']['category-name'])) {
// Break up shortcode categories into an array to make searching easy
}
- // If there's categories specified with the shortcode
+ // If there's categories specified above ($cats array)
if (count($cats) > 0) {
/* * Restrict available categories for selection to those in shortcode or children
}
$catSelected = implode(',', $cats);
+ $catSelectedForQuery = $catSelected;
// If we're doing category search selection Get category filter data
if ($this->config['settings']['list_show_search_category']) {
// Since we have one category selected by the user, make that default
if ($c && isset($categoryData[$c])) {
$categoryData[$c]['default'] = true;
- $catSelected = $c;
+ $catSearchSelected = $c;
+
+ // Also set that to be the only category used in the query
+ $catSelectedForQuery = $catSearchSelected;
}
}
}
- if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
- glmMembersFront::addNotice("<b>Categories Requested:</b> $catSelected", 'Process');
-
- }
// If we have a category ID or IDs
- if ($catSelected != '') {
+ if ($catSelectedForQuery != '') {
$where .= $whereSep." T.id in (
SELECT DISTINCT(member_info)
FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."category_member_info M,
".GLM_MEMBERS_PLUGIN_DB_PREFIX."categories C
- WHERE M.category in($catSelected)
- OR (C.parent in($catSelected) AND M.category = C.id)
+ WHERE M.category in($catSelectedForQuery)
+ OR (C.parent in($catSelectedForQuery) AND M.category = C.id)
)";
$whereSep = ' AND ';
'categories' => $categoryData,
'singleCategory' => $singleCategory,
'catSelected' => $catSelected,
+ 'catSearchSelected' => $catSearchSelected,
'amenities' => $amenityData,
'amenSelected' => $amenSelected,
'alphaList' => $alphaList,