VotingAPI and Fivestar function very well if you want to implement a voting widget and all necessary functionalities that comes with it.

When I wanted to implement “Login to Vote” functionality -voting widget behaving similar to the comments for anonymous users-, I came across the following snippet which works flawlessly. Just rename [nameofyourtheme] to your theme name (without []) and insert it in your template.php file and you are good to go.

* Display a static fivestar value as stars with a title and description.

function [nameofyourtheme]_fivestar_static_element($value, $title = NULL, $description = NULL) {
  $output .= '<div class="fivestar-static-form-item">';
  $element = array(
    '#type' => 'item',
    '#title' => $title,

  $output .= theme('form_element', $element, $value);
  $output .= '<div class="description">'. t('Login or register to vote.') .'</div>';
  $output .= '</div>';
  return $output;

Source: quicksketch

Comments are closed.