I recently noticed that my TagOrder module stopped working. Specifically, The tags were never in the order they were intended to be.

After looking into the code, I found specifically that there was a single point of failure.

There was a check for "$node->taxonomy['tags'][$vocabid]"

This code returned false, not because the 'tags' didn't contain any vocabulary matching vocabid, but because 'tags' itself returned null.

That being said, the taxonomy itself was not empty.

Comments

mwisner’s picture

StatusFileSize
new2.46 KB

The attached patch should resolve the current issues with tagorder.

Edit: Use updated patch in comment #3!

jrstmartin’s picture

Status: Needs work » Needs review

Thank you so much! Works! D6.25, tagorder 6.x-1.5

Edit: Ouch. Yeah it works but changes all form IDs in the <form> tag, for example <form id="node-form" changes to <form id="1" and will break lots of themes and who knows what else.

jrstmartin’s picture

StatusFileSize
new2.46 KB

Oh. Just a syntax error. $form['#id'] == 'node-form'. New patch attached.

mwisner’s picture

Ohh man, sorry about that.

Thanks for the find!

perlgal’s picture

The patch in #3 works!

Many Thanks.

wstopa’s picture

For those of you who have upgraded to 6.29, I've found that the following line needs to be modified slightly. I'm unsure if this is directly related to the form API change or not.

I noticed that when calling array_unshift($form['#submit'], 'tagorder_submit_alter'), the callback tagorder_submit_alter is never executed. Replacing "#submit" with "#validate" seems to solve this problem.

Current: array_unshift($form['#submit'], 'tagorder_submit_alter');
New: array_unshift($form['#validate'], 'tagorder_submit_alter');