It doesn't record a vote. I have no trouble with decisions and advpoll recording votes which seems to imply that the infrastructure is working fine.
What happens in detail:
Total votes recorded 0. This despite the fact that I voted on one of the questions. The interesting part is that it asks me if I want to cancel the vote. It therefore is aware of a voting action.
I checked the tables:
pollfield contains the node and active contains a "1". (runtime contains 0)
pollfield_votes contains the node with a delta of "2" for the correct user.
Why would it not report the poll result?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | pollfield.module.151020.patch | 400 bytes | jaydub |
Comments
Comment #1
regli commentedIt appears that the vote gets recorded correctly as the table content_field_test_poll_field contains the correct vote under the delta. However, the display does not seem to pick it up correctly.
Comment #2
regli commentedIt seems clear now that it is a cache issue.
The function pollfield_clear($node) does not seem to function properly in terms of flushing the cache. I should note that I even run with cache disabled in the "performance" option at this time (development).
As soon as I clicked on "Empty cache" in the devel module, the vote appeared correctly.
Comment #3
naught101 commentedAlso have this problem, and it makes the module unusable for a production site.
Comment #4
naught101 commentedduplicate issue, with patch:
http://drupal.org/node/138907
Comment #5
jaydub commentedWell cache_content is the cache table that is used for CCK types. Now http://drupal.org/node/138907 mentions possible problems with not having the cache_content table but while I am not sure about the ins and outs of that, I do know what fixed this problem for me.
If you look in the CCK content.module you will see that the cache_get call for CCK types uses a cache key of 'content:$nid:$vid'.
Pollfield module requires that the CCK cache for this node gets cleared every time there is a vote or a canceled vote. The problem with the cache_clear_all() invocation in pollfield_clear() function is that the cache key that is used does not contain the $vid (or simply the $nid repeated in this case).
See attached patch to fix
Comment #6
karens commentedFixed in latest commit. You're right about the missing vid component.
The cache_content table was added to CCK somewhere along the line and would only be missing in an installation that had an outdated CCK version. The pollfield module code by April of 2007 had an if/then to clear the table whether it was named 'cache' or 'cache_content', so that should have worked at the time that the issue at http://drupal.org/node/138907 was reported.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #8
JamoSmith commentedI had to change it from:
$cid = 'content:'. $node->nid .':'. $node->nid;
to:
$cid = 'content:'. $node->nid .':'. $node->vid;
for it to work. I couldn't get things to work right the way yall recommended above so I checked my cache_content table and noticed it was 760:1405 not 760:760, so I threw in vid and it worked. Maybe this will help someone else in the future, or perhaps someone can provide insight as to why this worked or why this isn't a safe thing to do.
*after more testing. with caching enabled: 15 minutes. drupal 5.7
I found a somewhat unrelated issue. but decided to post it here since I made the above changes:
When a user votes for the first time, they are forwarded to a refreshed page with the appropriate results, but upon refreshing the node second time they are given the option to vote a second time (which results in an error). I have checked the cache_content table and there is no row with cid = 760:1405.
much appreciated.
Comment #9
pcorbett commentedI can confirm #8 above. I had the same issue where my cids were not being recorded in the format nid:nid, but rather had nid:vid. I don't have revisions turned on for my node type, but my poll votes are definitely not being recorded as nid:nid. Changing this to nid:vid as in #8 fixed the issue. Also, the issue #8 brings up at the end about refreshing the page and allowing a user to vote again does not happen for me.
Comment #10
bryan kennedy commentedClosing this because it still appears to be a duplicate of http://drupal.org/node/138907 which fixes the issue. Also very old with no activity.