details.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Modbash Clean Elgg Theme
  4. *
  5. * Copyright (c) 2015 ModBash
  6. *
  7. * @author Shane Barron <admin@modbash.com>
  8. * @copyright 2015 SocialApparatus
  9. * @license GNU General Public License (GPL) version 2
  10. * @version 1
  11. * @link http://modbash.com
  12. */
  13. $user = elgg_get_page_owner_entity();
  14. $profile_fields = elgg_get_config('profile_fields');
  15. echo '<td><div id="profile-details">';
  16. echo "<span class=\"hidden nickname p-nickname\">{$user->username}</span>";
  17. echo "<h2 class=\"p-name fn\">{$user->name}</h2>";
  18. // the controller doesn't allow non-admins to view banned users' profiles
  19. if ($user->isBanned()) {
  20. $title = elgg_echo('banned');
  21. $reason = ($user->ban_reason === 'banned') ? '' : $user->ban_reason;
  22. echo "<div class='profile-banned-user'><h4 class='mbs'>$title</h4>$reason</div>";
  23. }
  24. echo elgg_view("profile/status", array("entity" => $user));
  25. $microformats = array(
  26. 'mobile' => 'tel p-tel',
  27. 'phone' => 'tel p-tel',
  28. 'website' => 'url u-url',
  29. 'contactemail' => 'email u-email',
  30. );
  31. $even_odd = null;
  32. if (is_array($profile_fields) && sizeof($profile_fields) > 0) {
  33. foreach ($profile_fields as $shortname => $valtype) {
  34. if ($shortname == "description") {
  35. // skip about me and put at bottom
  36. continue;
  37. }
  38. $value = $user->$shortname;
  39. if (!is_null($value)) {
  40. // fix profile URLs populated by https://github.com/Elgg/Elgg/issues/5232
  41. // @todo Replace with upgrade script, only need to alter users with last_update after 1.8.13
  42. if ($valtype == 'url' && $value == 'http://') {
  43. $user->$shortname = '';
  44. continue;
  45. }
  46. // validate urls
  47. if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) {
  48. $value = "http://$value";
  49. }
  50. // this controls the alternating class
  51. $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
  52. ?>
  53. <div class="<?php echo $even_odd; ?>">
  54. <b><?php echo elgg_echo("profile:{$shortname}"); ?>: </b>
  55. <?php
  56. $params = array(
  57. 'value' => $value
  58. );
  59. if (isset($microformats[$shortname])) {
  60. $class = $microformats[$shortname];
  61. } else {
  62. $class = '';
  63. }
  64. echo "<span class=\"$class\">";
  65. echo elgg_view("output/{$valtype}", $params);
  66. echo "</span>";
  67. ?>
  68. </div>
  69. <?php
  70. }
  71. }
  72. }
  73. if ($user->description) {
  74. echo "<p class='profile-aboutme-title'><b>" . elgg_echo("profile:aboutme") . "</b></p>";
  75. echo "<div class='profile-aboutme-contents'>";
  76. echo elgg_view('output/longtext', array('value' => $user->description, 'class' => 'mtn'));
  77. echo "</div>";
  78. }
  79. echo '</div></td></tr></table>';