revoke_email_invitation.php 917 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Revoke an email inviation for a group
  4. */
  5. $annotation_id = (int) get_input("annotation_id");
  6. $group_guid = (int) get_input("group_guid");
  7. if (!empty($group_guid) && !empty($annotation_id)) {
  8. $group = get_entity($group_guid);
  9. $annotation = elgg_get_annotation_from_id($annotation_id);
  10. if (!empty($group) && elgg_instanceof($group, "group") && !empty($annotation)) {
  11. if ($group->canEdit() && ($annotation->name == "email_invitation")) {
  12. if ($annotation->delete()) {
  13. system_message(elgg_echo("group_tools:action:revoke_email_invitation:success"));
  14. } else {
  15. register_error(elgg_echo("group_tools:action:revoke_email_invitation:error"));
  16. }
  17. } else {
  18. register_error(elgg_echo("groups:cantedit"));
  19. }
  20. } else {
  21. register_error(elgg_echo("groups:notfound:details"));
  22. }
  23. } else {
  24. register_error(elgg_echo("InvalidParameterException:MissingParameter"));
  25. }
  26. forward(REFERER);