Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal: Fivestar Block with voting axis
    primarykey
    data
    text
    <p>I'm using fivestar 1.19 with voting axis. I believe the default fivestar block/fivestar function uses only the default 'vote' tag.</p> <blockquote> <p>fivestar_widget_form($node)</p> </blockquote> <p>I need to pass my custom fivestar tag to the function. </p> <p>Attempting to follow the answer below: For me $object is $node.</p> <pre><code> &lt;?php function custom_fivestar_widget ($object) { global $user; $star_display = variable_get('fivestar_style_'. $object-&gt;type, 'average'); $text_display = variable_get('fivestar_text_'. $object-&gt;type, 'dual'); if ($star_display == 'average' &amp;&amp; ($text_display == 'average' || $text_display == 'none')) { // Save a query and don't retrieve the user vote unnecessarily. $votes = fivestar_get_votes($object-&gt;type, $object-&gt;nid, 'score', 0); } else { $votes = fivestar_get_votes($object-&gt;type, $object-&gt;nid); } $values = array( 'user' =&gt; isset($votes['user']['value']) ? $votes['user']['value'] : 0, 'average' =&gt; isset($votes['average']['value']) ? $votes['average']['value'] : 0, 'count' =&gt; isset($votes['count']['value']) ? $votes['count']['value'] : 0, ); $settings = array( 'stars' =&gt; variable_get('fivestar_stars_'. $object-&gt;type, 10), 'allow_clear' =&gt; variable_get('fivestar_unvote_'. $object-&gt;type, FALSE), 'style' =&gt; $star_display, 'text' =&gt; $text_display, 'content_type' =&gt; $object-&gt;type, 'content_id' =&gt; $object-&gt;nid, 'tag' =&gt; 'score', 'autosubmit' =&gt; TRUE, 'title' =&gt; variable_get('fivestar_title_'. $object-&gt;type, 1) ? NULL : FALSE, 'feedback_enable' =&gt; variable_get('fivestar_feedback_'. $object-&gt;type, 1), 'labels_enable' =&gt; variable_get('fivestar_labels_enable_'. $object-&gt;type, 1), 'labels' =&gt; variable_get('fivestar_labels_'. $object-&gt;type, array()), ); return fivestar_custom_widget($form_state, $values, $settings); } print drupal_get_form('custom_fivestar_widget', $object); ?&gt; </code></pre> <p>This prints me the widget, I believe using my score. However the text display is all wrong, as is the average score. And it gives everything a permanent 10 stars. :(</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload