delete.php 626 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Elgg Market Plugin
  4. * @package market
  5. */
  6. // Get input data
  7. $guid = (int) get_input('guid');
  8. // Make sure we actually have permission to edit
  9. $post = get_entity($guid);
  10. if ($post->getSubtype() == "market" && $post->canEdit()) {
  11. elgg_load_library('market');
  12. // Delete the market post
  13. $return = market_delete_post($post);
  14. if ($return) {
  15. // Success message
  16. system_message(elgg_echo("market:deleted"));
  17. } else {
  18. // Error message
  19. register_error(elgg_echo("market:notdeleted"));
  20. }
  21. // Forward to the main market page
  22. forward(elgg_get_site_url() . "market");
  23. }