add photo count to photo album list
This commit is contained in:
parent
35d42f8626
commit
8b66329a8f
@ -264,7 +264,7 @@ function photos_albums_list($channel,$observer) {
|
||||
|
||||
$sql_extra = permissions_sql($channel_id);
|
||||
|
||||
$albums = q("SELECT distinct album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra order by created desc",
|
||||
$albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra group by album order by created desc",
|
||||
intval($channel_id),
|
||||
intval(PHOTO_NORMAL),
|
||||
intval(PHOTO_PROFILE)
|
||||
@ -280,6 +280,7 @@ function photos_albums_list($channel,$observer) {
|
||||
foreach($albums as $k => $album) {
|
||||
$entry = array(
|
||||
'text' => $album['album'],
|
||||
'total' => $album['total'],
|
||||
'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']),
|
||||
'urlencode' => urlencode($album['album']),
|
||||
'bin2hex' => bin2hex($album['album']));
|
||||
|
@ -3,7 +3,9 @@
|
||||
{{if $albums}}
|
||||
<ul>
|
||||
{{foreach $albums as $al}}
|
||||
<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a></li>
|
||||
{{if $al.text}}
|
||||
<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a> ({{$al.total}})</li>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
|
Reference in New Issue
Block a user