Any changes to taxonomy settings of any category and the term settings on my multiple select, non-freetagging, required vocabulary resets itself to the defaults. Oddly, it doesn't affect my free tagging category.

Comments

Palo M.’s picture

I also met exactly same problem, on Drupal 6.
It can be easily reproduced following way:
1. In vocabulary settings I have set only multiple selection flag.
2. I have several terms in vocabulary.
3. Set term_display settings for vocabulary to some non-default (e.g. custom with non-zero weight).
4. All works as expected.
5. Update any term of the vocabulary (e.g. change description).
6. The term_display stopped working. When editing vocabulary settings again, term_display parameters are reset to default. It can be used, just each update of term will reset it again.

It seems that term_display_taxonomy is called also when any term is updated (at least in my D6).
I was able to suppress the unwanted resets by following change in it:
Old code:

      case 'update':
        db_query('DELETE FROM {term_display} WHERE vid = %d', $object['vid']);
        // Fall through.
      case 'insert':
        db_query("INSERT INTO {term_display} (vid, style, weight) VALUES (%d, '%s', %d)", $object['vid'], $object['term_display_style'], $object['term_display_weight']);
        break;

New code:

      case 'update':
        if ($object['term_display_style']) {
          // style is provided, only this is meaningful update
          db_query("UPDATE {term_display} SET style = '%s', weight = %d WHERE vid = %d LIMIT 1", $object['term_display_style'], $object['term_display_weight'], $object['vid']);
        }
        break;
      case 'insert':
        db_query("INSERT INTO {term_display} (vid, style, weight) VALUES (%d, '%s', %d)", $object['vid'], $object['term_display_style'], $object['term_display_weight']);
        break;

(Alternatively there can be one DELETE and one INSERT instead of UPDATE, I just believe that one DB command is better than two...)

I'm quite new to Drupal and php, so I'm not sure about correctness, but at least it works fine for me.

nedjo’s picture

Status: Active » Fixed

Thanks Palo M. I've applied a modified version of this patch.

Status: Fixed » Closed (fixed)

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