Update for frontHooks. When to call in coupons.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 9 Dec 2016 21:08:31 +0000 (16:08 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 9 Dec 2016 21:08:31 +0000 (16:08 -0500)
For the detail page only get coupons if the option to display on detail
page is set.

setup/frontHooks.php

index b3784a4..60e8099 100644 (file)
  *  *** Also note that parameters will be in the context of the main front controller constructor. ***
  */
 // Add content to member detail page - Get it from the existing coupon shortcode
-add_filter('glm-member-db-front-members-detail-descriptionAfter', function($content, $id) {
-        $eventData = do_shortcode('[glm-members-coupons-list member='.$id.' template="member-detail"]');
-        $content .= $eventData;
+add_filter('glm-member-db-front-members-detail-descriptionAfter',
+    function($content, $id) {
+        global $config;
+        if ( $config['settings']['detail_show_coupons'] ) {
+            $eventData = do_shortcode('[glm-members-coupons-list member='.$id.' template="member-detail"]');
+            $content .= $eventData;
+        }
         return $content;
     },
     10,