From 01c9d13927da443995f57d38ac2fcf53cc9a0794 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 5 Dec 2015 23:29:42 +0100 Subject: [PATCH] Issue 1871: Show an information if a group is empty --- mod/group.php | 3 ++- view/templates/groupeditor.tpl | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mod/group.php b/mod/group.php index e9f9561f46..5b28784f56 100644 --- a/mod/group.php +++ b/mod/group.php @@ -190,6 +190,7 @@ function group_content(&$a) { 'label_members' => t('Members'), 'members' => array(), 'label_contacts' => t('All Contacts'), + 'group_is_empty' => t('Group is empty'), 'contacts' => array(), ); @@ -204,7 +205,7 @@ function group_content(&$a) { group_rmv_member(local_user(),$group['name'],$member['id']); } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 and `pending` = 0 and `self` = 0 ORDER BY `name` ASC", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC", intval(local_user()) ); diff --git a/view/templates/groupeditor.tpl b/view/templates/groupeditor.tpl index b0f267dde9..86458ded2e 100644 --- a/view/templates/groupeditor.tpl +++ b/view/templates/groupeditor.tpl @@ -2,7 +2,11 @@

{{$groupeditor.label_members}}

-{{foreach $groupeditor.members as $c}} {{$c}} {{/foreach}} +{{if $groupeditor.members }} + {{foreach $groupeditor.members as $c}} {{$c}} {{/foreach}} +{{else}} +{{$groupeditor.group_is_empty}} +{{/if}}

-- 2.39.5