I am using rate module and the number up down widget, and in the settings for this module I had set it to appear at the top of content. It was appearing fine. However, now I am using a panel for this node and the widget no longer appears as expected. I need to embed it into my panel. How would I go about this? I have done a few searchs and found rate_embed, but I am not having any luck getting this to work. I have tried the following. My rate widget is called 'points', and its settings are at /admin/structure/rate/:


<?php rate_embed(&$node, $machine_name, $mode = RATE_FULL); ?>

What I tried:

<?php print rate_embed($node, 'points', $mode = RATE_FULL); ?>
<?php echo rate_embed($node, 'points', $mode = RATE_FULL); ?>

this was giving an error that rate_embed was acting on a non-object.

  • you have to display only count value alone? – Sathiya Dec 10 '12 at 6:29
  • No, I want to display the actual widget itself in my panel so that a plus / minus number button appears for the user to vote. – Andrew Welch Dec 10 '12 at 9:58

You can try the following code.

 $up_down = rate_generate_widget('1', 'node', {current node id}, RATE_FULL, TRUE, FALSE, NULL);
 print render($up_down);
|improve this answer|||||
  • this module could also work nicely with this code: drupal.org/project/widgets – Andrew Welch Dec 11 '12 at 11:28
  • how would I get the current node id in there? curently that code gives: Parse error: syntax error, unexpected '{' in /home/andrewwe/public_html/wequest.co.uk/modules/php/php.module(80) : eval()'d code on line 4 – Andrew Welch Dec 12 '12 at 17:16
  • You can get node id as arg(1). Verify did you enabled rating for that particular content type /admin/structure/rate/ – Sathiya Dec 13 '12 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.