You are here

function fivestar_update_7207 in Fivestar 7.2

Preserve setting after new feature preventing own votes.

See also

http://drupal.org/node/189527

File

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

Code

function fivestar_update_7207() {
  $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 own votes.
      $instance['settings']['allow_ownvote'] = TRUE;

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