anon_user_details.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. This view gets called before the default profile/details view
  4. It checks to see if we are looking at the anonymous user profile
  5. If we are looking at the profile and are not an admin, it registers an error and
  6. sends them back to the page they came from.
  7. */
  8. global $CONFIG;
  9. $anon_guid = elgg_get_plugin_setting('anon_guid','AU_anonymous_comments');
  10. $user = get_user($anon_guid);
  11. // 1.8 changed things, no $vars['entity'] anymore so we're parsing the URL
  12. //if they're not admin and trying view anon_user, register error and send them away
  13. if (strpos($_SERVER['REQUEST_URI'], "profile/$user->username") && !elgg_is_admin_logged_in()){
  14. register_error(elgg_echo('AU_anonymous_comments:profile_view'));
  15. forward(REFERRER);
  16. }
  17. // they are admin and viewing anon_user - show warning about deletion
  18. if (elgg_is_admin_logged_in() && $speakfreelywarningcount != 1 && strpos($_SERVER['REQUEST_URI'], "profile/$user->username")){
  19. //counter to prevent more than one display of this view - have to track down that bug
  20. $speakfreelywarningcount = 1;
  21. ?>
  22. <div class="AU_anonymous_comments_warning">
  23. <?php echo elgg_echo('AU_anonymous_comments:profile:warning'); ?>
  24. </div>
  25. <?php
  26. }