content type settings are not respected
ahwayakchih - July 27, 2006 - 13:40
| Project: | Voting |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
If nid is not found in node_voting database table then voting.module tries to use content type settings.
Problem is that voting.module stores those settings as string (like: 'never', 'always', etc...) so when nodeapi 'view' is called and module checks like:
if ($node->voting) {
// shows voting part
}voting part is ALWAYS there because at load time $node->voting is set to value from content type settings (so it's a non-empty string) and thus it returns TRUE whenever it's checked like above.
Here's a patch which fixes that (i wanted to change smallest possible part of code, so i didn't change values stored at content type settings, only added additional check at node load time).
| Attachment | Size |
|---|---|
| voting.module.patch.txt | 634 bytes |

#1
there was one more bug (at validating it didn't get voting default for node type), and one "not so compatible" part (at validation time You can't change node - AFAIK changes doesn't happen anyway - so i've added support for "submit" operation).
#2
Excellent! Thanks for the patch. Works great so far.
#3
works for me too, thank you!
#4
Thanks, me to!
#5
Applied to current CVS, thanks for the patch. Should work right now with the current download.