Index: fivestar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fivestar/fivestar.module,v
retrieving revision 1.8
diff -u -r1.8 fivestar.module
--- fivestar.module	15 Jan 2008 07:11:05 -0000	1.8
+++ fivestar.module	8 Feb 2008 00:26:56 -0000
@@ -7,6 +7,7 @@
  */
 
 function fivestar_help($path, $arg) {
+  $output = '';
   switch ($path) {
     case 'admin/settings/fivestar':
       $output = t('This page is used to configure site-wide features of the fivestar module. To setup fivestar to rate content:');
@@ -21,7 +22,7 @@
 }
 
 /**
- * Implementation of hook_menu.
+ * Implementation of hook_menu().
  * Provides a callback url where votes can be submitted by the client-side
  * javascript.
  */
@@ -277,6 +278,7 @@
         'below' => t('Below the node body'),
         'above_static' => t('Static display above the node body'),
         'below_static' => t('Static display below the node body'),
+        'template_variable' => t('Include as a template variable'),
         'hidden' => t('<Hidden>'),
       ),
     );
@@ -660,7 +662,9 @@
   }
   if ($user->uid) {
     $user_vote = votingapi_select_votes($criteria += array('uid' => $user->uid));
-    $votes['user'] = $user_vote[0];
+    if ($user_vote) {
+      $votes['user'] = $user_vote[0];
+    }
   }
   else {
     // If the user is anonymous, we never bother loading their existing votes.
@@ -730,7 +734,7 @@
 function fivestar_nodeapi(&$node, $op, $teaser, $page) {
   switch ($op) {
     case 'view':
-      if ($node->in_preview == FALSE && variable_get('fivestar_'. $node->type, 0)) {
+      if (empty($node->in_preview) && variable_get('fivestar_'. $node->type, 0)) {
         if ($teaser) {
           $position = variable_get('fivestar_position_teaser_'. $node->type, 'above');
         }
@@ -841,7 +845,7 @@
     'labels' => variable_get('fivestar_labels_'. $node->type, array()),
   );
 
-  return fivestar_custom_widget(&$form_state, $values, $settings);  
+  return fivestar_custom_widget($form_state, $values, $settings);  
 }
 
 function fivestar_static($content_type, $content_id, $node_type = NULL) {
@@ -952,6 +956,7 @@
     '#required' => isset($settings['required']) ? $settings['required'] : FALSE,
     '#labels_enable' => isset($settings['labels_enable']) ? $settings['labels_enable'] : TRUE,
     '#labels' => isset($settings['labels']) ? $settings['labels'] : NULL,
+    '#attributes' => array('class' => ''),
   );
 
   $form['fivestar_submit'] = array(
@@ -1066,6 +1071,13 @@
 }
 
 /**
+ * Preprocess node
+ */
+function fivestar_preprocess_node(&$variables) {
+  $variables['fivestar_widget'] = fivestar_widget_form($variables['node']);
+}
+
+/**
  * Theme the fivestar form element by adding necessary css and javascript.
  */
 function theme_fivestar($element) {
@@ -1343,4 +1355,4 @@
     }
     return theme('fivestar_static', $value, $stars);
   }
-}
\ No newline at end of file
+}
