--- fivestar.module.orig	2007-07-07 08:03:03.000000000 -0700
+++ fivestar.module	2007-07-07 10:57:46.000000000 -0700
@@ -253,7 +253,11 @@ function fivestar_vote($type, $cid, $val
       $summary[$data->function] = $data->value;
     }
   }
-  $output .= '<summary>'. theme('fivestar_summary', $summary['average'], $summary['count'], $stars) .'</summary>';
+  $sum_out = theme('fivestar_summary', $summary['average'], $summary['count'], $stars);
+  if ($sum_out = '') {
+    $sum_out = t('your vote was successfully placed');
+  }
+  $output .= '<summary>'. $sum_out .'</summary>';
   $output .= '</result>';
 
   $output .= '<vote>';
@@ -477,65 +481,71 @@ function fivestar_form($content_type, $c
 
   $form = array();
 
-  $form['content_type'] = array(
-    '#type' => 'hidden',
-    '#value' => $content_type,
-  );
-
-  $form['content_id'] = array(
-    '#type' => 'hidden',
-    '#value' => $content_id,
-  );
-
-  $form['vote'] = array(
-    '#type' => 'fivestar',
-    '#stars' => $stars,
-    '#vote_count' => $current_count->value,
-    '#vote_average' => $current_avg->value,
-    '#default_value' => $current_vote->value,
-    '#auto_submit' => TRUE,
-    '#auto_submit_path' => 'fivestar/vote/' . $content_type . '/' . $content_id,
-    '#allow_clear' => variable_get('fivestar_unvote_'. (!isset($node) ? 'default' : $node->type), FALSE),
-    '#content_id' => $content_id,
-  );
-
-  switch ($style) {
-    case 'compact':
-      // We actually don't need anything more here.
-      break;
-
-    case 'default':
-      $form['vote']['#title'] = t('Your vote');
-      $form['vote']['#description'] = theme('fivestar_summary', $current_avg->value, $current_count->value, $stars);
-      break;
-
-    case 'dual':
-      $form['vote']['#title'] = t('Your vote');
-      $form['average'] = array(
-        '#type' => 'item',
-        '#title' => t('Current rating'),
-        '#value' => theme('fivestar_static', $current_avg->value, $stars)
-      );
-
-      break;
-  }
+  if (user_access('rate content')) {
+    $form['content_type'] = array(
+      '#type' => 'value',
+      '#value' => $content_type,
+    );
   
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Submit rating'),
-    '#attributes' => array('class' => 'fivestar-submit'),
-  );
+    $form['content_id'] = array(
+      '#type' => 'value',
+      '#value' => $content_id,
+    );
+  
+    $form['vote'] = array(
+      '#type' => 'fivestar',
+      '#stars' => $stars,
+      '#vote_count' => $current_count->value,
+      '#vote_average' => $current_avg->value,
+      '#default_value' => $current_vote->value,
+      '#auto_submit' => TRUE,
+      '#auto_submit_path' => 'fivestar/vote/' . $content_type . '/' . $content_id,
+      '#allow_clear' => variable_get('fivestar_unvote_'. (!isset($node) ? 'default' : $node->type), FALSE),
+      '#content_id' => $content_id,
+    );
+  
+    switch ($style) {
+      case 'compact':
+        // We actually don't need anything more here.
+        break;
+  
+      case 'default':
+        $form['vote']['#title'] = t('Your vote');
+        $form['vote']['#description'] = theme('fivestar_summary', $current_avg->value, $current_count->value, $stars);
+        break;
+  
+      case 'dual':
+        $form['vote']['#title'] = t('Your vote');
+        $form['average'] = array(
+          '#type' => 'item',
+          '#title' => t('Current rating'),
+          '#value' => theme('fivestar_static', $current_avg->value, $stars)
+        );
+  
+        break;
+    }
+    
+    $form['submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Submit rating'),
+      '#attributes' => array('class' => 'fivestar-submit'),
+    );
+  
+    // Add javascript to hide the submit button.
+    if (strpos(drupal_get_js(), "jQuery('input.fivestar-submit').hide()") === FALSE) {
+      drupal_add_js("jQuery(function(){jQuery('input.fivestar-submit').hide();});", 'inline');
+    }
+  
+    $form['#attributes']['class'] = 'fivestar-widget';
+    $form['#base'] = 'fivestar_form';
+    $form['#redirect'] = FALSE;
 
-  // Add javascript to hide the submit button.
-  if (strpos(drupal_get_js(), "jQuery('input.fivestar-submit').hide()") === FALSE) {
-    drupal_add_js("jQuery(function(){jQuery('input.fivestar-submit').hide();});", 'inline');
+    return $form;
+  }
+  else {
+    return theme('fivestar_summary', $current_avg->value, $current_count->value, $stars);
   }
 
-  $form['#attributes']['class'] = 'fivestar-widget';
-  $form['#base'] = 'fivestar_form';
-  $form['#redirect'] = FALSE;
-
-  return $form;
 }
 
 /**
@@ -633,12 +643,14 @@ function theme_fivestar_static($rating, 
 }
 
 function theme_fivestar_summary($rating, $votes = 0, $stars = 5) {
-  if ($votes == 0) {
-    return t('No votes yet');
-  }
-  $stars = round(($rating * $stars) / 100, 1);
-  $vote_text = format_plural($votes, t('vote'), t('votes'));
-  return t('Average: !stars (!votes !vote_text)', array('!stars' => $stars, '!votes' => $votes, '!vote_text' => $vote_text));
+  if (user_access('view ratings')) {
+    if ($votes == 0) {
+      return t('No votes yet');
+    }
+    $stars = round(($rating * $stars) / 100, 1);
+    $vote_text = format_plural($votes, t('vote'), t('votes'));
+    return t('Average: !stars (!votes !vote_text)', array('!stars' => $stars, '!votes' => $votes, '!vote_text' => $vote_text));
+  } else return '';
 }
 
 /**
@@ -671,21 +683,21 @@ function fivestar_expand($element) {
 
   if (isset($element['#vote_count'])) {
     $element['vote_count'] =  array(
-      '#type' => 'hidden',
+      '#type' => 'value',
       '#value' => $element['#vote_count'],
     );
   }
 
   if (isset($element['#vote_average'])) {
     $element['vote_average'] =  array(
-      '#type' => 'hidden',
+      '#type' => 'value',
       '#value' => $element['#vote_average'],
     );
   }
 
   if ($element['#auto_submit'] && !empty($element['#auto_submit_path'])) {
     $element['auto_submit_path'] =  array(
-      '#type' => 'hidden',
+      '#type' => 'value',
       '#value' => url($element['#auto_submit_path']),
       '#attributes' => array('class' => 'fivestar-path'),
     );
