profile_view_profile

Versions
4.6 – 5
profile_view_profile($user)
6
profile_view_profile(&$user)

Code

modules/profile.module, line 216

<?php
function profile_view_profile($user) {

  profile_load_profile($user);

  // Show private fields to administrators and people viewing their own account.
  if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) {
    $result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight');
  }
  else {
    $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_PRIVATE);
  }

  while ($field = db_fetch_object($result)) {
    if ($value = profile_view_field($user, $field)) {
      $description = ($field->visibility == PROFILE_PRIVATE) ? t('The content of this field is private and only visible to yourself.') : '';
      $title = ($field->type != 'checkbox') ? check_plain($field->title) : '';
      $fields[$field->category] .= form_item($title, $value, $description);
    }
  }

  return $fields;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.