From e616b257dacab14ec58cfda4afd6cfa720489867 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 3 Nov 2017 16:31:32 -0400 Subject: [PATCH] adding size parameter to the get_images filter allowing user to pick a size to return the full image url from the filter --- setup/frontHooks.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup/frontHooks.php b/setup/frontHooks.php index d0579c97..d9e1fe07 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -331,12 +331,19 @@ if (!function_exists('addUrlProtocol')) { /* * */ -add_filter('member_images', function($memberID, $featured = false){ +add_filter('member_images', function($memberID, $featured = false, $size = 'large'){ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php'; $Images = new GlmDataImages($this->wpdb, $this->config); $imageGallery = $Images->getGallery($this->config['ref_type_numb']['MemberInfo'], $memberID,$featured); - return $imageGallery; -}, 10, 2); + if(is_array($imageGallery)){ + $featuredImage = array_pop($imageGallery); + $featuredImage = GLM_MEMBERS_PLUGIN_MEDIA_URL .'/images/'.$size.'/'.$featuredImage['file_name']; + } else { + $featuredImage = false; + } + return $featuredImage; +}, 10, 3); + add_filter('member_categories', function(){ include_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCategories.php'; $categories = new GlmDataCategories( $this->wpdb, $this->config ); -- 2.17.1