Here is the scenario: I have here the video module that upload videos, I have used the fivestar module to rate those videos uploaded. The user can only rate videos if he/she download/watch the video. If the user does not download the the videofile, the fivestar rating is disabled, where user can't put rating on it. How do I modify the code, or there is a quick solution for this? Thanks in advance.

Comments

chris33’s picture

Anybody can advised this?

quicksketch’s picture

Sounds like you generally just need some sort of JavaScript solution. In your node.tpl.php (or node-video.tpl.php or template.php) file, add a JS file to the page that only shows the rating widget after some event. Because it's difficult to know what your situation specifically needs, here's a chunk of starter code:

In node.tpl.php:
drupal_add_js($directory .'/hide-rating.js')

And in a new file called "hide-rating.js" in your theme directory:

if (Drupal.jsEnabled) {
  $(document).ready(function() {
    $('.fivestar-widget').css('display', 'none');
    $('a').click(function() {
      $('.fivestar-widget').slideDown();
    });
  );
}

For more information:
http://api.drupal.org/api/function/drupal_add_js/5
http://visualjquery.com

quicksketch’s picture

Status: Active » Closed (fixed)