On my site, I have two vocabularies that can be applied to project_release nodes: api, and os. I've noticed a problem where if a user who does not have 'administer projects' permissions edits a release node, even if it's just the body that's getting edited, when the node is saved again the value of the api taxonomy term that was associated with the release gets erased. This doesn't happen for users with 'administer projects' permissions. Furthermore, the select box for the api term wasn't added to the edit form if the user was not adding a release node but instead was editing one that existed already.
I have tracked this problem down to the project_release_load() function. In my case the query in that function was actually returning two tid values, but the first row returned was not the tid that is associated with api version but instead was that associated with the OS version. Later, when project_release_alter_release_form() gets called it doesn't have the right value for $node->version_api_tid and therefore the control for this taxonomy term is not added to the form. Thus, when the release node is saved the taxonomy term is removed since it wasn't added to the edit form in the first place.
I've attached a patch that modifies the query in project_release_load() to match the vid returned by _project_release_get_api_vid(). I've tested this patch on my site and it does what I want it to do and I haven't found any side effects yet.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | api_tid.patch | 1.09 KB | hunmonk |
| project_release_load_api_vid_0.txt | 909 bytes | aclight |
Comments
Comment #1
hunmonk commentedthis is a needed fix. updated patch:
tested and working on postgres. please test and confirm on mysql, and RTBC if she's ready!
Comment #2
aclight commentedlooks good on mysql. RTBC
Comment #3
hunmonk commentedfixed in HEAD, 4.7.x-2.x. doesn't look like 4.7.x-1.x used taxo for releases in that way, so nothing to do there.
Comment #4
(not verified) commented