cleanup.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Cleanup the group sidebar
  4. */
  5. $group_guid = (int) get_input("group_guid");
  6. $owner_block = get_input("owner_block");
  7. $actions = get_input("actions");
  8. $menu = get_input("menu");
  9. $members = get_input("members");
  10. $search = get_input("search");
  11. $featured = get_input("featured");
  12. $featured_sorting = get_input("featured_sorting");
  13. $my_status = get_input("my_status");
  14. $forward_url = REFERER;
  15. $group = get_entity($group_guid);
  16. if (!empty($group) && ($group instanceof ElggGroup)) {
  17. if ($group->canEdit()) {
  18. $prefix = "group_tools:cleanup:";
  19. $group->setPrivateSetting($prefix . "owner_block", $owner_block);
  20. $group->setPrivateSetting($prefix . "actions", $actions);
  21. $group->setPrivateSetting($prefix . "menu", $menu);
  22. $group->setPrivateSetting($prefix . "members", $members);
  23. $group->setPrivateSetting($prefix . "search", $search);
  24. $group->setPrivateSetting($prefix . "featured", $featured);
  25. $group->setPrivateSetting($prefix . "featured_sorting", $featured_sorting);
  26. $group->setPrivateSetting($prefix . "my_status", $my_status);
  27. $forward_url = $group->getURL();
  28. system_message(elgg_echo("group_tools:actions:cleanup:success"));
  29. } else {
  30. register_error(elgg_echo("groups:cantedit"));
  31. }
  32. } else {
  33. register_error(elgg_echo("groups:notfound:details"));
  34. }
  35. forward($forward_url);