JomSocial: Preventing Album Reposts When Uploading Single Picture

I’ve been working on another site and it features JomSocial (Joomla 2.5, JomSocial 3.0) along with the “activities” module that lists the latest activity as far as pictures, videos, comments, forum, etc.

One of my biggest irritations with the activity list was this:

I created separate album, say per city or subject and would upload maybe 5 pictures one day.   Months later, when I go to upload a new photo pertaining to that subject/album, not only would my new photo show up in the activities feed, but ALL photos (up to the limit of 5), even if they were months old.  It would make other updates of photos drop down the feed and the new photos become lost.  So, today I dug in the code and created a bit of a mod.  I’m sure it might be buggy or can be improved upon, but for now – it gets the job done.

in file:  /components/com_community/libraries/photos.php

at line 81, after

$albumsHelper = new CAlbumsHelper( $album );  insert this:
$db = JFactory::getDBO();
$sql = “SELECT * FROM #__community_photos WHERE `albumid`=”.$album->id
.” AND `id`=” . $photoid
.” AND `status` != ‘temp'”;
$db->setQuery($sql);
$result = $db->loadObject();
$created = $result->created;

at line 116, replace:

$sql = “SELECT * FROM #__community_photos WHERE `albumid`=”.$album->id
  .” AND `status` != ‘temp'”
  .” ORDER BY `id` DESC LIMIT 0, 5″;

with:

//$sql = “SELECT * FROM #__community_photos WHERE `albumid`=”.$album->id
//.” AND `status` != ‘temp'”
//.” ORDER BY `id` DESC LIMIT 0, 5″;
$sql = “SELECT * FROM #__community_photos WHERE `albumid`=”.$album->id.” AND `created` LIKE ‘”.date(‘Y-m-d’,strtotime($created))
.”%’ AND `status` != ‘temp'”
.” ORDER BY `id` DESC LIMIT 0, 5″;

What I aimed to do is …

Continue Reading