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

AttachmentSize
voting.module.patch.txt634 bytes

#1

ahwayakchih - July 27, 2006 - 14:53

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

drawk - September 9, 2006 - 15:40

Excellent! Thanks for the patch. Works great so far.

#3

marcoBauli - September 27, 2006 - 11:13

works for me too, thank you!

#4

gte451f - October 6, 2006 - 11:39

Thanks, me to!

#5

drawk - October 6, 2006 - 12:05

Applied to current CVS, thanks for the patch. Should work right now with the current download.

 
 

Drupal is a registered trademark of Dries Buytaert.