By Sabih on Saturday, 12 December 2015
Likes 0
Views 767
Votes 0
Hey there,

I wanted to make a change that "likes" do not bring up stream posts back to the top. There I picked the file /components/com_easysocial/controllers/likes.php and in line 146 (line 4 down below the code) I replace "true" with "false".

Did this happen to have an effect on anything else or can this be done this way?


Content of file line 142-162:

// Now we need to update the associated stream id from the liked object
if ($streamId) {

$doUpdate = false;

if ($type == 'photos') {
$sModel = ES::model('Stream');
$totalItem = $sModel->getStreamItemsCount($streamId);

if ($totalItem > 1) {
$doUpdate = false;
}
}

if ($doUpdate) {
$stream = ES::stream();
$stream->updateModified($streamId, $this->my->id, SOCIAL_STREAM_LAST_ACTION_LIKE);
}
}
}
Hey Sabih,

I am really sorry for the delay of this reply as it is a weekend for us here. You don't really need to hack any codes. Just go to Settings > Stream > Pagination and set the option "Items sorting" to "new creation date".

This way, when someone likes the photo, the stream item wouldn't get bumped up.

If you specifically only want to prevent likes from pushing items to the top, just comment out line 163 below:


$stream->updateModified($streamId, $this->my->id, SOCIAL_STREAM_LAST_ACTION_LIKE);
·
Saturday, 12 December 2015 18:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Mark. Working great with the outcommenting.
·
Sunday, 13 December 2015 23:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Sabih,

You are most welcome.
·
Monday, 14 December 2015 11:42
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post