You are here

function hook_rate_vote_alter in Rate 6.2

Same name and namespace in other branches
  1. 7 rate.hooks.inc \hook_rate_vote_alter()

Alter the vote before it is saved.

Parameters

array $vote: array( 'entity_type' => $content_type, 'entity_id' => $content_id, 'value_type' => $widget->value_type, 'value' => $value, 'tag' => $widget->tag, );

array $context: array( 'redirect' => &$redirect, // Path. Alter to redirect the user. 'save' => &$save, // Boolean indicating whether the vote must be saved. 'widget' => $widget, // Widget object, unalterable. );

1 invocation of hook_rate_vote_alter()
rate_save_vote in ./rate.module
Save a vote to the database.

File

./rate.hooks.inc, line 78

Code

function hook_rate_vote_alter($vote, $context) {

  // Redirect users to the feedback page when they click on thumbs down.
  if ($context['widget']->name == 'thumbs_up_down' && $vote['value'] == -1) {
    $context['redirect'] = 'feedback';
  }
}