welcome_message.php 931 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Save the group welcome message
  4. */
  5. $group_guid = (int) get_input("group_guid");
  6. $welcome_message = get_input("welcome_message");
  7. $forward_url = REFERER;
  8. if (!empty($group_guid)) {
  9. $group = get_entity($group_guid);
  10. if (!empty($group) && elgg_instanceof($group, "group")) {
  11. if ($group->canEdit()) {
  12. $check_message = trim(strip_tags($welcome_message));
  13. if (!empty($check_message)) {
  14. $group->setPrivateSetting("group_tools:welcome_message", $welcome_message);
  15. } else {
  16. $group->removePrivateSetting("group_tools:welcome_message");
  17. }
  18. system_message(elgg_echo("group_tools:action:welcome_message:success"));
  19. $forward_url = $group->getURL();
  20. } else {
  21. register_error(elgg_echo("groups:cantedit"));
  22. }
  23. } else {
  24. register_error(elgg_echo("groups:notfound:details"));
  25. }
  26. } else {
  27. register_error(elgg_echo("InvalidParameterException:MissingParameter"));
  28. }
  29. forward($forward_url);