edit.php 759 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Upload and crop an avatar page
  4. */
  5. // Only logged in users
  6. elgg_gatekeeper();
  7. elgg_push_context('settings');
  8. elgg_push_context('profile_edit');
  9. $title = elgg_echo('avatar:edit');
  10. $entity = elgg_get_page_owner_entity();
  11. if (!elgg_instanceof($entity, 'user') || !$entity->canEdit()) {
  12. register_error(elgg_echo('avatar:noaccess'));
  13. forward(REFERER);
  14. }
  15. $content = elgg_view('core/avatar/upload', array('entity' => $entity));
  16. // only offer the crop view if an avatar has been uploaded
  17. if (isset($entity->icontime)) {
  18. $content .= elgg_view('core/avatar/crop', array('entity' => $entity));
  19. }
  20. $params = array(
  21. 'content' => $content,
  22. 'title' => $title,
  23. );
  24. $body = elgg_view_layout('one_sidebar', $params);
  25. echo elgg_view_page($title, $body);