Commit be35ea20 authored by Penny Leach's avatar Penny Leach
Browse files

groups: don't show honking great update membership button if there are no members to update

parent 5cc49173
......@@ -352,6 +352,7 @@ $smarty->assign('canpromote', $canpromote);
$smarty->assign('canupdate', $canupdate);
$smarty->assign('canacceptinvite', $invited);
$smarty->assign('group', $group);
$smarty->assign('hasmembers', group_has_members($group->id));
$smarty->display('group/view.tpl');
......
......@@ -284,4 +284,13 @@ function group_add_member($groupid, $userid) {
$user = optional_userobj($userid);
}
function group_has_members($groupid) {
$sql = 'SELECT (
(SELECT COUNT(*) FROM {group_member} WHERE "group" = ?)
+
(SELECT COUNT(*) FROM {group_member_request} WHERE "group" = ?)
)';
return count_records_sql($sql, array($groupid, $groupid));
}
?>
......@@ -56,7 +56,7 @@
<tbody>
</tbody>
</table>
{if $canupdate}
{if $canupdate && $hasmembers}
<input type="button" class="button" value="{str tag='updatemembership' section='group'}" onclick="return updateMembership();" id="groupmembers_update">
{/if}
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment