When using fivestar fields in embedded view, the rendered select elemens are assigned the same ids. Only the first instance of embedded view saves votes correctly.
To prevent this you may implement the following hooks:

function mymodule_element_info_alter(&$type){
  $type['fivestar']['#process'][] = 'mymodule_process_fivestar';
}

function mymodule_process_fivestar(&$element){
  $element['vote']['#ajax']['callback'] = 'mymodule_fivestar_ajax_submit_hook';
  $element['vote']['#parents'][0].=$element['#settings']['content_id'];
  return $element;
}

function mymodule_fivestar_ajax_submit_hook(&$form, &$form_state) {
  $content_id = $form['vote']['#settings']['content_id'];
  $form_state['values']['vote'] = $form_state['values']['vote'.$content_id]; 
  return fivestar_ajax_submit(&$form, &$form_state);
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drone.ah’s picture

A patch to the module based on the code above.

Status: Needs review » Needs work

The last submitted patch, 0001-allow-multiple-fivestar-fields-in-embedded-views.patch, failed testing.

dbt102’s picture

Issue summary: View changes
Status: Needs work » Fixed

Please test with 7.x-2.2 release and report back, as there have been a lot of fixes applied since then.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.