From 7b8c4c55aba0305f64c59f4810d5e07ac8f7cba1 Mon Sep 17 00:00:00 2001 From: Tomasz Dziuda Date: Tue, 17 Sep 2013 09:40:06 +0200 Subject: [PATCH] Fixed some inconsistiences in the JomSocial DB records structure --- mod_gk_js_feed/helper.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mod_gk_js_feed/helper.php b/mod_gk_js_feed/helper.php index 2074648..9a2dfa1 100644 --- a/mod_gk_js_feed/helper.php +++ b/mod_gk_js_feed/helper.php @@ -34,11 +34,11 @@ public function __construct($module, $params) { public function getData() { $db = JFactory::getDBO(); $actor_condition = ''; - + if(trim($this->config['user_id']) != '' && is_numeric($this->config['user_id'])) { $actor_condition = ' AND a.actor = ' . $this->config['user_id'] . ' '; } - + if($this->config['content_type'] == 'status') { $query = ' SELECT @@ -46,12 +46,12 @@ public function getData() { title, actor FROM - #__community_activities + #__community_activities AS a WHERE - like_type = "profile.status" + a.like_type = "profile.status" '.$actor_condition.' ORDER BY - created DESC + a.created DESC LIMIT '.$this->config['offset'].', 1;'; $db->setQuery($query); @@ -60,13 +60,13 @@ public function getData() { $avatar = ''; $url = ''; $username = ''; - + if($statuses = $db->loadObjectList()) { foreach($statuses as $status) { $user_id = $status->actor; $user = CFactory::getUser($user_id); $username = CStringHelper::escape($user->getDisplayName()); - + if($this->config['show_avatar'] == 1) { $avatar = $user->getAvatar(); } @@ -99,7 +99,13 @@ public function getData() { ON a.like_id = p.id WHERE - a.like_type = "photo" + ( + a.like_type = "photo" + OR + a.like_type = "albums" + ) + AND + p.id IS NOT NULL '.$actor_condition.' ORDER BY a.created DESC @@ -110,14 +116,14 @@ public function getData() { $text = ''; $photo = ''; $url = ''; - + if($statuses = $db->loadObjectList()) { foreach($statuses as $status) { if($this->config['show_text'] == 1) { $status_text = CStringHelper::escape($status->title); $text = (strlen($status_text) > $this->config['photo_text_limit']) ? substr($status_text, 0, $this->config['photo_text_limit']) . '…' : $status_text; } - + if($this->config['image_type'] == 'image') { $photo = $status->image; } elseif($this->config['image_type'] == 'thumbnail') {