Adjust member category filter to allow parameters
authorLaury GvR <laury@gaslightmedia.com>
Mon, 2 Jul 2018 20:00:31 +0000 (16:00 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Mon, 2 Jul 2018 20:00:31 +0000 (16:00 -0400)
The member_category filter calls a function which has 3 possible
parameters, one of which allows any unassigned categories not to
show in the list. The filter itself did not allow these parameters,
causing empty categories to display whenever the filter is invoked.
The defaults for this filter are set to the same defaults that the
function has, meaning it should not impact sites already using it.

setup/frontHooks.php

index edda4b7..3cf1deb 100644 (file)
@@ -382,11 +382,11 @@ add_filter('member_images', function($memberID, $featured = false, $size = 'larg
     return $featuredImage;
 }, 10, 3);
 
-add_filter('member_categories', function(){
+add_filter('member_categories', function($forEdit = true, $forActiveMembers = false, $regionList = false){
     include_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCategories.php';
     $categories = new GlmDataCategories( $this->wpdb, $this->config );
-    return $categories->getListSortedParentChild();
-});
+    return $categories->getListSortedParentChild($forEdit, $forActiveMembers, $regionList);
+}, 10, 3);
 add_filter('member_names_and_ids', function(){
     include_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php';
     $members = new GlmDataMembers( $this->wpdb, $this->config );