Filter to add event in custom spots in custom viewfiles
authorLaury GvR <laury@gaslightmedia.com>
Fri, 26 Jan 2018 20:53:24 +0000 (15:53 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 26 Jan 2018 20:53:24 +0000 (15:53 -0500)
Added a filter to add events in a custom location on custom
member detail viewfiles. Normally events are added using the
descriptionAfter filter. Any viewfile can use this filter to
display the events separately as long as the descriptionAfter
filter in said viewfile is removed.

setup/frontHooks.php

index 4e55154..6e823fc 100644 (file)
@@ -203,6 +203,19 @@ if (isset($this->config['addOns']['glm-member-db'])) {
         10,
         2
     );
+        
+    // Add content to member detail page - Get it from the existing event listing shortcode
+    // Unlike the filters above this one is not listed by default on the member detail page
+    //  but can be applied to custom member db view files if they remove any "descriptionAfter"
+    //  filter application
+    add_filter('glm-member-db-front-members-detail-events', function($content, $id) {
+            $eventData = do_shortcode('[glm-members-event-list member='.$id.', template="member-detail" order="title"]');
+            $content .= $eventData;
+            return $content;
+        },
+        10,
+        2
+    );
 
 }