group_settings.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. $group_guid = (int) get_input('group_guid');
  3. $solution_time = (int) get_input('solution_time');
  4. $who_can_ask = get_input('who_can_ask');
  5. $who_can_answer = get_input('who_can_answer');
  6. $auto_mark_correct = get_input('auto_mark_correct');
  7. if (empty($group_guid)) {
  8. register_error(elgg_echo('error:missing_data'));
  9. forward(REFERER);
  10. }
  11. elgg_entity_gatekeeper($group_guid, 'group');
  12. $group = get_entity($group_guid);
  13. if (!$group->canEdit()) {
  14. register_error(elgg_echo('actionunauthorized'));
  15. forward(REFERER);
  16. }
  17. // save the settings
  18. if (questions_can_groups_set_solution_time()) {
  19. $group->setPrivateSetting('questions_solution_time', $solution_time);
  20. }
  21. if (questions_experts_enabled()) {
  22. $group->setPrivateSetting('questions_who_can_ask', $who_can_ask);
  23. $group->setPrivateSetting('questions_auto_mark_correct', $auto_mark_correct);
  24. if (!questions_experts_only_answer()) {
  25. $group->setPrivateSetting('questions_who_can_answer', $who_can_answer);
  26. }
  27. }
  28. system_message(elgg_echo('questions:action:group_settings:success'));
  29. forward($group->getURL());