Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using Thumbs up/down widget to display results on each node and I have caching enabled for anon users.
I see 50% / 50% for every node until I click on thumb up or down to get the correct result returned with Ajax.
When I click refresh on this page, I get 50% / 50% again. Any help how to set up this widget not to get cached?
Comment | File | Size | Author |
---|---|---|---|
#7 | 1757554.patch | 594 bytes | pianomansam |
Comments
Comment #1
mauritsl CreditAttribution: mauritsl commentedDid you check the settings under "Interaction" when editing the widget?
Comment #2
alesr CreditAttribution: alesr commentedI don't use Rate on this project any more but as I remember Interaction was set to get the results immediately.
I think the problem lies in Varnish cache.
Comment #3
ewheel CreditAttribution: ewheel commentedSame problem with 1.6.
Comment #4
gregoirevincke CreditAttribution: gregoirevincke commentedSame problem with 1.6. BUT : do not occurs in a fresh drupal7.19 install, but in a production version, with lots of others modules installed. In the FF debug console, I have two messages concerning use of deprecated getAttributeNode(), and use of deprecated "NodeValue" attribute in jquery. Theses messages do not occurs in the fersh installation. Do not know if there is a link between theses messages and the problem.
Comment #5
gregoirevincke CreditAttribution: gregoirevincke commentedForget my past message.
After some debug, i've founded the source of the problem.
The bug is due to the "Use source translation" option, wich "delete" the id of the content rated due to a lack of validity testing of the result of a node_load().
In the file rate.module, in the function rate_get_results(), at line 477 you will find :
Before that line $criteria['entity_id'] is equal to node id, and after that _rate_get_source_translation() function call it is = 0, so the datas extracted from the database are null.
This _rate_get_source_translation() function is defined at line 440 in rate.module :
Note that there is a validity test of $tnid if we are NOT on the node page, but not if we ARE on the node page. So if node_load() return a zero value for tnid, the value of $entity_id is set to 0.
The bug is so in line 444, as there is no validity test on the result of node_load($entity_id)->tnid;.
To repair, replace :
at line 444 by
It's the first time i report a bug correction, so i hope that i set the tags correctly.
Cheers.
Grégoire
Comment #6
gregoirevincke CreditAttribution: gregoirevincke commentedI think that my tags are incorrect ("patch (to be ported)" instead of "needs review"). As they cannot be edited, here is a new post to more correctly describe the solution proposed.
Comment #7
pianomansam CreditAttribution: pianomansam commented@gvincke Thank you for the fine research. Your proposed bug fix seems to be working for me. I've created a patch file for it. Can we get some more people to test this?
Comment #8
Yuri CreditAttribution: Yuri commentedPatching #7 does not work. Manually applied, worked.