delete.php 678 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Elgg profile plugin edit default profile action removal
  4. *
  5. */
  6. $id = get_input('id');
  7. $fieldlist = elgg_get_config('profile_custom_fields');
  8. if (!$fieldlist) {
  9. $fieldlist = '';
  10. }
  11. $fieldlist = str_replace("{$id},", "", $fieldlist);
  12. $fieldlist = str_replace(",{$id}", "", $fieldlist);
  13. $fieldlist = str_replace("{$id}", "", $fieldlist);
  14. if ($id &&
  15. unset_config("admin_defined_profile_$id") &&
  16. unset_config("admin_defined_profile_type_$id") &&
  17. elgg_save_config('profile_custom_fields', $fieldlist)) {
  18. system_message(elgg_echo('profile:editdefault:delete:success'));
  19. } else {
  20. register_error(elgg_echo('profile:editdefault:delete:fail'));
  21. }
  22. forward(REFERER);