diff --git a/RestControllers/GroupsController.php b/RestControllers/GroupsController.php index a2ecf4a..5590f2b 100644 --- a/RestControllers/GroupsController.php +++ b/RestControllers/GroupsController.php @@ -138,6 +138,13 @@ class GroupsController { $settings->set_id($groupID); $settings->set_name(postString("name", 3)); + //Get group visibility + $visiblity = postString("visibility", 3); + $levels = array_flip(self::GROUPS_VISIBILITY_LEVELS); + if(!isset($levels[$visiblity])) + Rest_fatal_error(400, "Unrecognized group visibility level!"); + $settings->set_visibility($levels[$visiblity]); + //Try to save the new settings of the group if(!components()->groups->set_settings($settings)) Rest_fatal_error(500, "An error occured while trying to update group settings!"); diff --git a/classes/components/GroupsComponent.php b/classes/components/GroupsComponent.php index c97952c..b19bcad 100644 --- a/classes/components/GroupsComponent.php +++ b/classes/components/GroupsComponent.php @@ -336,6 +336,9 @@ class GroupsComponent { if($settings->has_logo()) $data["path_logo"] = $settings->get_logo(); + if($settings->has_visibility()) + $data["visibility"] = $settings->get_visibility(); + return $data; } } diff --git a/classes/models/GroupInfo.php b/classes/models/GroupInfo.php index 081ee57..9df7cf8 100644 --- a/classes/models/GroupInfo.php +++ b/classes/models/GroupInfo.php @@ -20,7 +20,7 @@ class GroupInfo extends BaseUniqueObject { private $number_members = -1; private $logo; private $membership_level = -1; - private $visiblity; + private $visiblity = -1; //Get and set the name of group