Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.236
diff -u -r1.236 profile.module
--- modules/profile/profile.module	3 Feb 2008 19:36:46 -0000	1.236
+++ modules/profile/profile.module	13 Feb 2008 00:40:26 -0000
@@ -54,7 +54,7 @@
 function profile_theme() {
   return array(
     'profile_block' => array(
-      'arguments' => array('account' => NULL, 'fields' => array()),
+      'arguments' => array('account' => NULL, 'fields' => array(), 'profile_link' => NULL), 
       'template' => 'profile-block',
     ),
     'profile_listing' => array(
@@ -169,21 +169,18 @@
           $fields = array();
           $result = db_query('SELECT name, title, type, visibility, weight FROM {profile_fields} WHERE visibility IN (%d, %d) ORDER BY weight', PROFILE_PUBLIC, PROFILE_PUBLIC_LISTINGS);
           while ($record = db_fetch_object($result)) {
-            // Ensure that field is displayed only if it is among the defined block fields and, if it is private, the user has appropriate permissions.
+            // Ensure that field is displayed only if it is among the
+            // defined block fields and, if it is private, the user has
+            // appropriate permissions.
             if (isset($use_fields[$record->name]) && $use_fields[$record->name]) {
               $fields[] = $record;
             }
           }
         }
 
-        if (!empty($fields)) {
-          $profile = _profile_update_user_fields($fields, $account);
-          $output .= theme('profile_block', $account, $profile, TRUE);
-        }
-
-        if (isset($use_fields['user_profile']) && $use_fields['user_profile']) {
-          $output .= '<div>'. l(t('View full user profile'), 'user/'. $account->uid) .'</div>';
-        }
+        $profile = _profile_update_user_fields($fields, $account);
+        $profile_link = (isset($use_fields['user_profile']) && $use_fields['user_profile']); 
+        $output .= theme('profile_block', $account, $profile, $profile_link, TRUE);
       }
 
       if ($output) {
@@ -481,7 +478,6 @@
  * @see profile-block.tpl.php
  */
 function template_preprocess_profile_block(&$variables) {
-
   $variables['picture'] = theme('user_picture', $variables['account']);
   $variables['profile'] = array();
   // Supply filtered version of $fields that have values.
@@ -492,7 +488,9 @@
       $variables['profile'][$field->name]->type = $field->type;
     }
   }
-
+  if ($variables['profile_link']) { 
+  	$variables['profile_link'] = 'user/'. $variables['account']->uid;
+  }
 }
 
 /**
@@ -505,7 +503,6 @@
  * @see profile-listing.tpl.php
  */
 function template_preprocess_profile_listing(&$variables) {
-
   $variables['picture'] = theme('user_picture', $variables['account']);
   $variables['name'] = theme('username', $variables['account']);
   $variables['profile'] = array();
@@ -517,7 +514,6 @@
       $variables['profile'][$field->name]->type = $field->type;
     }
   }
-
 }
 
 /**
Index: modules/profile/profile-block.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile-block.tpl.php,v
retrieving revision 1.2
diff -u -r1.2 profile-block.tpl.php
--- modules/profile/profile-block.tpl.php	7 Aug 2007 08:39:35 -0000	1.2
+++ modules/profile/profile-block.tpl.php	13 Feb 2008 00:40:25 -0000
@@ -7,8 +7,9 @@
  * block. It only shows in relation to a node displayed as a full page.
  *
  * Available variables:
- * - $picture: Image configured for the account linking to the users page.
+ * - $picture: Image configured for the account linking to the user's page.
  * - $profile: Keyed array of all profile fields that have a value.
+ * - $profile_link: Relative URL to the user's page.
  *
  * Each $field in $profile contains:
  * - $field->title: Title of the profile field.
@@ -30,13 +31,20 @@
  * @see template_preprocess_profile_block()
  */
 ?>
-<?php print $picture; ?>
-
-<?php foreach ($profile as $field) : ?>
-  <p>
-    <?php if ($field->type != 'checkbox') : ?>
-      <strong><?php print $field->title; ?></strong><br />
-    <?php endif; ?>
-    <?php print $field->value; ?>
-  </p>
-<?php endforeach; ?>
+<?php if (!empty($profile) || $picture || $profile_link) : ?>
+  <?php print $picture; ?>
+  
+  <?php foreach ($profile as $field) : ?>
+    <p>
+      <?php if ($field->type != 'checkbox') : ?>
+        <strong><?php print $field->title; ?></strong><br />
+      <?php endif; ?>
+      <?php print $field->value; ?>
+    </p>
+  <?php endforeach; ?>
+  
+  <?php if ($profile_link) : ?>
+    <div><?php print l(t('View full user profile'), $profile_link); ?></div>
+  <?php endif; ?>
+  
+<?php endif; ?>
