You are here

function content_profile_show_profiles in Content Profile 6

Returns an array suitable for use with drupal_render, that shows all content_profiles as configured by the admin.

1 call to content_profile_show_profiles()
content_profile_user in ./content_profile.module
Implementation of hook_user().

File

./content_profile.module, line 513

Code

function content_profile_show_profiles($uid) {
  global $user;
  $content = array();
  foreach (content_profile_get_types('names') as $type => $type_name) {
    $node = content_profile_load($type, $uid);
    if (($style = content_profile_get_settings($type, 'user_display')) && $node && node_access('view', $node)) {
      $content['content_profile_' . $type] = array(
        '#theme' => $style == 'link' ? 'content_profile_display_link' : 'content_profile_display_view',
        '#edit_link' => content_profile_get_settings($type, 'edit_link'),
        '#uid' => $uid,
        '#style' => $style,
        '#content_type' => $type,
        '#weight' => content_profile_get_settings($type, 'weight'),
        '#suffix' => '<br />',
      );

      // Working around the bug described at http://drupal.org/node/302873
      module_load_include('inc', 'content_profile', 'content_profile.theme');
    }
    elseif (user_access('create ' . $type . ' content') && content_profile_get_settings($type, 'add_link') && !$node && ($uid == $user->uid || user_access('administer nodes'))) {
      $content['content_profile_' . $type] = array(
        '#admin' => $uid != $user->uid,
        '#theme' => 'content_profile_display_add_link',
        '#uid' => $uid,
        '#content_type' => $type,
        '#weight' => content_profile_get_settings($type, 'weight'),
        '#suffix' => '<br />',
      );
    }
  }
  if ($content) {
    $content['#prefix'] = '<p id="content-profile-view">';
    $content['#suffix'] = '</p>';
  }
  return $content;
}