From fd1b08b74cad4f68160541ff98f6fe758043cd2b Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 16 Jul 2018 08:52:41 +0200 Subject: [PATCH] Can update posts creation level of a group --- RestControllers/GroupsController.php | 7 +++++++ classes/components/GroupsComponent.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/RestControllers/GroupsController.php b/RestControllers/GroupsController.php index 0c9e18b..144f360 100644 --- a/RestControllers/GroupsController.php +++ b/RestControllers/GroupsController.php @@ -184,6 +184,13 @@ class GroupsController { Reset_fatal_error(400, "Unrecognized group registration level!"); $settings->set_registration_level($levels[$registration_level]); + //Get group posts creation levels + $postsLevel = postString("posts_level", 3); + $levels = array_flip(self::GROUPS_POSTS_LEVELS); + if(!isset($levels[$postsLevel])) + Rest_fatal_error(400, "Unrecognized group posts level!"); + $settings->set_posts_level($levels[$postsLevel]); + //Get and check group virtual directory $virtualDirectory = postString("virtual_directory", 0); if($virtualDirectory != ""){ diff --git a/classes/components/GroupsComponent.php b/classes/components/GroupsComponent.php index 695ca01..73a40f1 100644 --- a/classes/components/GroupsComponent.php +++ b/classes/components/GroupsComponent.php @@ -666,6 +666,9 @@ class GroupsComponent { if($settings->has_registration_level()) $data["registration_level"] = $settings->get_registration_level(); + + if($settings->has_posts_level()) + $data["posts_level"] = $settings->get_posts_level(); $data["virtual_directory"] = $settings->has_virtual_directory() ? $settings->get_virtual_directory() : "";