- $aside['$photos_title'] = t('Last photos');
- $aside['$photos_items'] = array();
- $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
- (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
- WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
- AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
- INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
- `user`
- WHERE `user`.`uid` = `photo`.`uid`
- AND `user`.`blockwall`=0
- ORDER BY `photo`.`edited` DESC
- LIMIT 0, 12",
- dbesc(t('Contact Photos')),
- dbesc(t('Profile Photos'))
- );
-
-
- if(count($r)) {
- $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
- foreach($r as $rr) {
- $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
- $photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
-
- $entry = replace_macros($tpl,array(
- '$id' => $rr['id'],
- '$profile-link' => $photo_page,
- '$photo' => $photo_url,
- '$alt-text' => $rr['username']." : ".$rr['desc'],
- ));
-
- $aside['$photos_items'][] = $entry;
+ if (Config::get('communityhome', 'showlastphotos')) {
+ $aside['$photos_title'] = L10n::t('Latest photos');
+ $aside['$photos_items'] = [];
+ $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
+ (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
+ WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
+ AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
+ INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
+ `user`
+ WHERE `user`.`uid` = `photo`.`uid`
+ AND `user`.`blockwall`=0
+ AND `user`.`hidewall` = 0
+ ORDER BY `photo`.`edited` DESC
+ LIMIT 0, 12",
+ dbesc(L10n::t('Contact Photos')),
+ dbesc(L10n::t('Profile Photos'))
+ );
+
+
+ if (count($r)) {
+ # $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+ $tpl = get_markup_template('directory_item.tpl', 'addon/communityhome/');
+ foreach ($r as $rr) {
+ $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
+ $photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.jpg';
+
+ $entry = replace_macros($tpl, [
+ '$id' => $rr['id'],
+ '$profile_link' => $photo_page,
+ '$photo' => $photo_url,
+ '$photo_user' => $rr['username'],
+ '$photo_title' => $rr['desc']
+ ]);
+
+ $aside['$photos_items'][] = $entry;
+ }