Skip to content

Commit

Permalink
Fixed some inconsistiences in the JomSocial DB records structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dziudek committed Sep 17, 2013
1 parent ded48a9 commit 7b8c4c5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions mod_gk_js_feed/helper.php
Expand Up @@ -34,24 +34,24 @@ 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
id,
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);
Expand All @@ -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();
}
Expand Down Expand Up @@ -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
Expand All @@ -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') {
Expand Down

0 comments on commit 7b8c4c5

Please sign in to comment.