add.php 671 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Elgg Donation plugin
  4. * @license: GPL v 2.
  5. * @author slyhne
  6. * @copyright Tiger Inc I/S
  7. * @link tiger-inc.eu
  8. */
  9. // block non-admin users
  10. admin_gatekeeper();
  11. action_gatekeeper();
  12. // Get the user
  13. $user_guid = (int) get_input('guid');
  14. $user = get_user($user_guid);
  15. if (($user instanceof ElggUser) && ($user->canEdit())) {
  16. $valid_period = elgg_get_plugin_setting('expires', 'donation')*2629743;
  17. $user->donation = time() + $valid_period;
  18. system_message(elgg_echo('donation:added'));
  19. donation_add_to_river($user, 'donation');
  20. } else {
  21. register_error(elgg_echo('donation:add:error'));
  22. }
  23. forward($_SERVER['HTTP_REFERER']);