Download & Extend

content type settings are not respected

Project:Voting
Version:master
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

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).

AttachmentSize
voting.module.patch.txt634 bytes

Comments

#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).

AttachmentSize
voting.module.patch_0.txt 1.22 KB

#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.

nobody click here