I have a situation where I want to control the number of decimals displayed on the vote value (truth be told, i had multiple entries with the same vote value and wanted to show more of a breakdown). Two small changes are needed to do this:

in function userreview_settings, add:

  $form['userreview_vote_decimal'] = array(
    '#type' => 'textfield', 
    '#default_value' => variable_get('userreview_vote_decimal','1'), 
    '#title' => 'Vote Decimal Places',
    '#description' => t('Number of decimal places to include with the vote value.'),
  );

in function theme_userreview_vote, support this:

/**
 * Themes a userreview vote number.  Places the caption below the numnber.
 * Using table layout for most consistent cross-browser & cross-theme layout.
 */
function theme_userreview_vote($vote_value) {
  $output = '';
  if (is_numeric($vote_value)) {
    $output .= '<table class="userreview_review_vote">';
    $display_number = $vote_value;
    if (floor($vote_value) < $vote_value) {
      $display_number = number_format($vote_value, variable_get('userreview_vote_decimal','1') );
    }
    $output .= '<tr><td class="userreview_review_number">' . $display_number . '</td></tr>';
    $caption = variable_get('userreview_vote_number_caption',t('out of 10'));
    if ($caption) {
      $output .= '<tr><td class="userreview_review_number_caption">' . $caption . '</td></tr>';
    }
    $output .= '</table>';
  }
  return $output;
}

Comments

jo1ene’s picture

Status: Active » Needs review
gerd riesselmann’s picture

Status: Needs review » Fixed

Included in new release

Anonymous’s picture

Status: Fixed » Closed (fixed)