Index: vud.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/vote_up_down/vud.theme.inc,v retrieving revision 1.8 diff -u -p -r1.8 vud.theme.inc --- vud.theme.inc 2 Aug 2010 05:12:08 -0000 1.8 +++ vud.theme.inc 22 Sep 2010 21:47:45 -0000 @@ -172,6 +172,7 @@ function vud_widget_proxy($content_id, $ $token_up = drupal_get_token("vote/$type/$content_id/1/$tag/$widget_theme"); $token_down = drupal_get_token("vote/$type/$content_id/-1/$tag/$widget_theme"); + $token_reset = drupal_get_token("votereset/node/$content_id/$tag"); $result_criteria = array( 'content_type' => $type, @@ -233,6 +234,19 @@ function vud_widget_proxy($content_id, $ $variables['readonly'] = $readonly; $link_up = url("vote/$type/$content_id/1/$tag/$widget_theme/$token_up"); $link_down = url("vote/$type/$content_id/-1/$tag/$widget_theme/$token_down"); + $link_reset = url("votereset/node/$content_id/$tag/$token_reset"); + + # Add check for vote reset permission. + + $variables['button_text_up'] = 'Vote'; + + if ($user_vote > 0) { + $link_up = $link_reset; + $variables['button_text_up'] = 'Unvote'; + } elseif ($user_vote < 0) { + $link_down = $link_reset; + } + $message_on_deny = variable_get('vud_message_on_deny', FALSE); $variables['show_links'] = !$readonly || $message_on_deny; if ($readonly) { @@ -253,8 +267,9 @@ function vud_widget_proxy($content_id, $ } } else { - $variables['link_class_up'] .= ' ctools-use-ajax'; - $variables['link_class_down'] .= ' ctools-use-ajax'; + # Add check for vote reset permission. + $variables['link_class_up'] .= ($user_vote > 0) ? '' : ' ctools-use-ajax'; + $variables['link_class_down'] .= ($user_vote < 0) ? '' : ' ctools-use-ajax'; } $variables['link_up'] = $link_up;