$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d $sql_extra order by created desc",
intval($a->data['user']['uid'])
);
-
- if(count($albums)) {
+
+ $ret = array('success' => false);
+ $albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
+
+ foreach($albums as $k => $album) {
+ if( $album['album'] === 'Contact Photos') {
+ unset ($albums[$k]['album']);
+ }
+ }
+
+ if($albums) {
+ if ($albums_visible) {
+ $ret['success'] = true;
+ }
+ $ret['albums'] = array();
+ 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'])
+ );
+ $ret['albums'][] = $entry;
+ }
+ }
+
+ /*return $ret;*/
+
+ $o = '';
+
+ if(! $albums) {
+ if(array_key_exists('albums', get_app()->data))
+ $albums = get_app()->data['albums'];
+ else
+ $albums = $ret;
+ }
+
+ $albums = $ret;
+
+
+ if($albums['success']) {
+ $o = replace_macros(get_markup_template('photo_albums.tpl'),array(
+ '$nick' => $a->data['user']['nickname'],
+ '$title' => t('Photo Albums'),
+ '$albums' => $albums['albums'],
+ '$baseurl' => z_root()
+ ));
+ }
+
+/* if(count($albums)) {
$a->data['albums'] = $albums;
$albums_visible = ((intval($a->data['user']['hidewall']) && (! local_user()) && (! remote_user())) ? false : true);
$o .= '</div>';
}
+ *
+ */
if(! x($a->page,'aside'))
$a->page['aside'] = '';
--- /dev/null
+<div id="side-bar-photos-albums" class="widget">
+ <h3>{{$title}}</h3>
+ <ul class="nav nav-pills nav-stacked">
+ <li><a href="{{$baseurl}}/photos/{{$nick}}" title="{{$title}}" >Recent Photos</a></li>
+ {{if $albums}}
+ {{foreach $albums as $al}}
+ {{if $al.text}}
+ <li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a></li>
+ {{/if}}
+ {{/foreach}}
+ {{/if}}
+ </ul>
+</div>