You are here

function fivestar_update_7206 in Fivestar 7.2

Preserve setting after new feature preventing re-votes.

See also

http://drupal.org/node/356605

File

./fivestar.install, line 239
Install, update, and uninstall functions the Fivestar module.

Code

function fivestar_update_7206() {
  $fields = field_read_fields(array(
    'type' => 'fivestar',
  ));
  foreach ($fields as $field) {

    // Iterate through the instances of the field.
    $instances = field_read_instances(array(
      'field_name' => $field['field_name'],
    ));
    foreach ($instances as $instance) {

      // The default should be to allow re-voting.
      $instance['settings']['allow_revote'] = TRUE;

      // Update the instance.
      field_update_instance($instance);
    }
  }
}