summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Corbett <sean@gnu.org>2010-09-05 14:16:46 -0400
committerSean Corbett <sean@gnu.org>2010-09-05 14:16:46 -0400
commit1b601160f423cfd7e195e8c2a4f6fc7a9cab7331 (patch)
treebcc23f0638ddda6ce3c6c197a061aa10f699118a
parent2f06e2904251dbf7e8fe1211eda585c46971b1b5 (diff)
Changes to only display currently viewed profile's pictures.
-rw-r--r--plugins/GNUsocialPhotos/actions/photos.php16
-rw-r--r--plugins/GNUsocialPhotos/classes/gnusocialphoto.php3
2 files changed, 16 insertions, 3 deletions
diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php
index 368f806ff..a9f76042b 100644
--- a/plugins/GNUsocialPhotos/actions/photos.php
+++ b/plugins/GNUsocialPhotos/actions/photos.php
@@ -99,8 +99,20 @@ class PhotosAction extends Action
}
$this->element('a', array('href' => 'photos?pageid=' . ($page+1) ), 'Next page');
- //TODO need to set album ID..
- $photos = GNUsocialPhoto::getGalleryPage($page, 0, 9);
+ $args = $this->returnToArgs();
+ $profile_nick = $args[1]['nickname']; //Nickname for the profile being looked at
+
+ //TODO choice of available albums by user.
+ //Currently based on fact that each user can only have one album.
+ error_log('profile nick:', 3, '/tmp/sean.log');
+ error_log($profile_nick, 3, '/tmp/sean.log');
+ $profile = Profile::staticGet('nickname', $profile_nick);
+ //error_log(',profile_id:', 3, '/tmp/sean.log');
+ //error_log($profile->id, 3, '/tmp/sean.log');
+ $album = GNUSocialPhotoAlbum::staticGet('profile_id', $profile->id);
+ //error_log(',album_id:', 3, '/tmp/sean.log');
+ //error_log($album->album_id, 3, '/tmp/sean.log');
+ $photos = GNUsocialPhoto::getGalleryPage($page, $album->album_id, 9);
$this->elementStart('ul', array('class' => 'photothumbs'));
foreach ($photos as $photo) {
diff --git a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php
index 1b5a54587..1314ba87e 100644
--- a/plugins/GNUsocialPhotos/classes/gnusocialphoto.php
+++ b/plugins/GNUsocialPhotos/classes/gnusocialphoto.php
@@ -116,7 +116,8 @@ class GNUsocialPhoto extends Memcached_DataObject
static function getGalleryPage($page_id, $album_id, $gallery_size)
{
$page_offset = ($page_id-1) * $gallery_size;
- $sql = 'SELECT * FROM GNUsocialPhoto order by notice_id limit ' . $page_offset . ',' . $gallery_size;
+ $sql = 'SELECT * FROM GNUsocialPhoto WHERE album_id = ' . $album_id .
+ ' ORDER BY notice_id LIMIT ' . $page_offset . ',' . $gallery_size;
$photo = new GNUsocialPhoto();
$photo->query($sql);
$photos = array();