A complaint that continues to show up from my members is that Group photos are sorted by the first photo added to the group. So when 30 photos have been added, to see number 30 you have to go through all the photos. It would be best if the last photo is the first one to be displayed on the group page; that way when someone adds a new photo to the group, it is display first instead of last and one does not have to hunt for it.
Now, I don't see a way to change the sort order.
In the group module I see this:
function getBlockCode_Photo() { return $this->_blockPhoto ($this->_oDb->getMediaIds($this->aDataEntry['id'], 'images'), $this->aDataEntry['author_id']); }
OK, and I see this function in BxDolTwigPageView :
function _blockPhoto (&$aReadyMedia, $iAuthorId, $sPrefix = false) { if (!$aReadyMedia) return '';
$aImages = array ();
foreach ($aReadyMedia as $iMediaId) {
$a = array ('ID' => $iAuthorId, 'Avatar' => $iMediaId);
$aImageFile = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search'); if ($aImageFile['no_image']) continue;
$aImageIcon = BxDolService::call('photos', 'get_image', array($a, 'icon'), 'Search'); if ($aImageIcon['no_image']) continue;
$aImages[] = array ( 'icon_url' => $aImageIcon['file'], 'image_url' => $aImageFile['file'], 'title' => $aImageIcon['title'], ); }
if (!$aImages) return '';
return $GLOBALS['oFunctions']->genGalleryImages($aImages); }
Any help on this? 
Geeks, making the world a better place |
we would have to find the sql query and add ORDER BY id (or whatever it is) DESC caredesign.net |
Geeks, making the world a better place |
$aImageFile = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search'); if ($aImageFile['no_image']) continue; Geeks, making the world a better place |
This is the Group Db file:
class BxGroupsDb extends BxDolTwigModuleDb { /* * Constructor. */ function BxGroupsDb(&$oConfig) { parent::BxDolTwigModuleDb($oConfig);
$this->_sTableMain = 'main'; $this->_sTableMediaPrefix = ''; $this->_sFieldId = 'id'; $this->_sFieldAuthorId = 'author_id'; $this->_sFieldUri = 'uri'; $this->_sFieldTitle = 'title'; $this->_sFieldDescription = 'desc'; $this->_sFieldTags = 'tags'; $this->_sFieldThumb = 'thumb'; $this->_sFieldStatus = 'status'; $this->_sFieldFeatured = 'featured'; $this->_sFieldCreated = 'created'; $this->_sFieldJoinConfirmation = 'join_confirmation'; $this->_sFieldFansCount = 'fans_count'; $this->_sTableFans = 'fans'; $this->_sTableAdmins = 'admins'; $this->_sFieldAllowViewTo = 'allow_view_group_to'; }
function deleteEntryByIdAndOwner ($iId, $iOwner, $isAdmin) { if ($iRet = parent::deleteEntryByIdAndOwner ($iId, $iOwner, $isAdmin)) { $this->query ("DELETE FROM `" . $this->_sPrefix . "fans` WHERE `id_entry` = $iId"); $this->query ("DELETE FROM `" . $this->_sPrefix . "admins` WHERE `id_entry` = $iId"); $this->deleteEntryMediaAll ($iId, 'images'); $this->deleteEntryMediaAll ($iId, 'videos'); $this->deleteEntryMediaAll ($iId, 'sounds'); $this->deleteEntryMediaAll ($iId, 'files'); } return $iRet; }
}
Geeks, making the world a better place |
looking now - i found something in the photos module, but checking to see what happens if i change it. Dont want to mess you up. caredesign.net |
Of course I am only interested in the Group Photo sorting in the Group Photo Block. I am wondering if making changes elsewhere would then affect the Member's photo albums as well. Geeks, making the world a better place |
i was wondering the same thing caredesign.net |
ok, based on my understanding (and that can be suspect at times) I first looked for the block which displays the photos for the groups. in the sys_page_compose table, the Photos block for the groups is using a function called Photo. I guess that would be the function to look for to find the sql statement. But I am having a hard time finding this function. caredesign.net |
This is one of those things that should be easy but won't be due to how it is all over the place. Geeks, making the world a better place |
If the photo block in groups is created by a global function, can I create a local function to handle it? Geeks, making the world a better place |
well - if i make a change on BxPhotosSearch (one to purposely mess up) I get a database error on my groups page. So, I am wondering if around line 217 is what needs to be edited, but then that would affect all images. Which really wouldnt be that big of a deal if a member adds images to their profile album, then they would be most recebnt first as well. Provided I can figure out why the added code is not changing anything even after clearing cache.
This is what I have so far but to no avail. Hopefully someone like deanos can jump in and tell us what we are doing wrong.
function _getImageDbInfo ($iId) { $iId = (int)$iId; $sqlQuery = "SELECT a.`ID` as `id`, a.`Ext` as `ext`, a.`Title` as `title`, a.`Desc` as `description`, a.`Uri` as `uri`, a.`Owner` as `owner`, a.`Date` as `date`, a.`Rate` as `rate`, a.`RateCount` as `rate_count`, a.`CommentsCount` as `comments_count`, a.`Views` as `views_count`, a.`Hash`, a.`Status` AS `status`, b.`id_album` as `album_id` FROM `bx_photos_main` as a LEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID` LEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album` WHERE a.`ID`='" . $iId . "' AND c.`Type`='bx_photos' ORDER BY a.`ID` DESC"; $aImageInfo = ($iId) ? db_arr($sqlQuery) : null; return $aImageInfo; }
caredesign.net |
That does not seem to have an effect; not even when I got to Photos and do a search. Geeks, making the world a better place |
after further looking at it, i think the sql statement calls for Limit 1, and that code above is after the id has been selected. That I believe just pulls the info for that particular image that has already been determined.
This is a weird one, as most all other functions in sys_page_compose I can find but not the Photo function. hmmmmm
caredesign.net |
I do appreciate your time and help on this. Geeks, making the world a better place |
This is one of those Dolphin areas where you have to have a real working site with real members to have an understanding of how to code things. The developers did not visual how members would want group photos to function because they did not have real world members using a real world site. This was a complaint from day one because it is a usability error. You can only see usability with real world users. Another complaint is that with the jquery photo view, you can not leave a comment on individual photos and members are complaining about it but fixing that is beyond me at the moment. Geeks, making the world a better place |
I am the type of person who will continue to work on something till I find out how to do it properly, or i find a way to do it that works for me. Unfortunately, this one has me stumped and I really wish I had more time to look into it. Once I finish this EHR module, I will get back to it if there is no answer by then. caredesign.net |
In the database I see bx_groups_images with fields entry_id and media_id; I assume this is associating a particular photo with the proper group; guessing because entry_id is not what I would have used is that is true. Geeks, making the world a better place |
I am guessing that you take the entry_id to get the media_id to pass to photosearch to get the actual photo. Am I anywhere close to how group photos are grabbed for the group photo block?. Then once we have them, we want to sort by the date of the photo. Geeks, making the world a better place |
there are several tables involved with the group images.
This is based on my understanding and logic and I hope it makes sense
sys_albums = album location of all photos - in my case, my groups album is labeled as hidden in this table, and the type is bx_photos and ObjCount iis the number of photos for that group
sys_albums_objects = finds all objects for the particular album or in our case, group. The id_album field should be equal to the ID field in sys_albums
bx_photos_main = all the info for every photo that was uploaded, regardless of what module was used when uploading. The ID field should be equal to id_object from sys_albums_objects table
bx_groups_images = beats the heck outta me, cause the media_id is equal to the ID field of the bx_photos_main.
And just writing that out gave me a migraine - roflmfaop. It is confusing as I dont know what.
caredesign.net |
if you want even more confusion, in the sys_albums_objects table there is an object order field. I tried changing mine from 0's to a 4,3,2,1 order for my images, and that didnt work either. caredesign.net |
Why is something as simple as wanting the newest group photos listed first such a complicated thing in Dolphin LOL. Geeks, making the world a better place |
Hello anyone, especially Boonex since his is a design flaw. Seriously, who wants to have to click on last icon, click on last icon, click on last icon, click on last icon, to finally see the latest photo loaded to the group? This is just common sense design to have the last photo uploaded displayed first. Geeks, making the world a better place |
Something like this should work... in theory:
function _blockPhoto (&$aReadyMedia, $iAuthorId, $sPrefix = false)
{
if (!$aReadyMedia)
return '';
$aImages = array ();
foreach ($aReadyMedia as $iMediaId) {
$a = array ('ID' => $iAuthorId, 'Avatar' => $iMediaId);
$aImageFile = BxDolService::call('photos', 'get_image', array($a, 'file'), 'Search');
if ($aImageFile['no_image'])
continue;
$aImageIcon = BxDolService::call('photos', 'get_image', array($a, 'icon'), 'Search');
if ($aImageIcon['no_image'])
continue;
$aImages[] = array (
'icon_url' => $aImageIcon['file'],
'image_url' => $aImageFile['file'],
'title' => $aImageIcon['title'],
'ts' => $aImageIcon['date'],
);
}
if (!$aImages)
return '';
function my_cmp($a, $b) {
return $a["ts"] < $b["ts"] ? 1 : -1;
}
usort($aImages, "my_cmp");
return $GLOBALS['oFunctions']->genGalleryImages($aImages);
}
Rules → http://www.boonex.com/terms |
Thanks Alex. I ran into a problem with trying to make it local to groups with a group module I have from the market. So I just added your array sort bit to the BxDolTwigPageView.php file. I was not aware of usort(); I am learning more every day. Geeks, making the world a better place |