profile_widgets.php 756 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * save setting to show widgets on closed groups
  4. */
  5. $group_guid = (int) get_input("group_guid");
  6. $profile_widgets = get_input("profile_widgets", "no");
  7. $forward_url = REFERER;
  8. if (!empty($group_guid)) {
  9. $group = get_entity($group_guid);
  10. if (!empty($group) && ($group instanceof ElggGroup) && $group->canEdit()) {
  11. $group->profile_widgets = $profile_widgets;
  12. if ($group->save()) {
  13. $forward_url = $group->getURL();
  14. system_message(elgg_echo("group_tools:action:success"));
  15. } else {
  16. register_error(elgg_echo("group_tools:action:error:save"));
  17. }
  18. } else {
  19. register_error(elgg_echo("group_tools:action:error:entity"));
  20. }
  21. } else {
  22. register_error(elgg_echo("group_tools:action:error:input"));
  23. }
  24. forward($forward_url);