group_tool_presets.php 561 B

12345678910111213141516171819202122232425
  1. <?php
  2. $presets = get_input("params");
  3. // filter out invalid input
  4. foreach ($presets as $index => $values) {
  5. if (!is_numeric($index)) {
  6. // the placeholder for cloning
  7. unset($presets[$index]);
  8. } elseif (!elgg_extract("title", $values)) {
  9. // title is required
  10. unset($presets[$index]);
  11. }
  12. }
  13. // reset array keys
  14. if (!empty($presets)) {
  15. $presets = array_values($presets);
  16. }
  17. elgg_set_plugin_setting("group_tool_presets", json_encode($presets), "group_tools");
  18. system_message(elgg_echo("group_tools:action:group_tool:presets:saved"));
  19. forward(REFERER);