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.
Energy is not getting added to nodes when viewing them.
I followed this video http://www.youtube.com/watch?v=vxXeJASe-QM using a fresh drupal 7.23 install with only ctools, radioactivity and radioactivitydefaults enabled.
Steps to reproduce:
download and install drupal 7.23
drush dl ctools, radioactivity
drush en ctools, radioactivity, radioactivitydefaults
add a radioactivity field to article
view incident energy set to 10
set display type to 'Raw numeric value'
accuracy set to 100
create an article
view the article and refresh page a few times and the number stays the same
Comment | File | Size | Author |
---|---|---|---|
#21 | 2136857-screenshot.png | 71.84 KB | tcmug |
Comments
Comment #1
nhero CreditAttribution: nhero commentedI was able to get it working using rules. If rules is indeed required it should be added as a dependency.
Comment #2
pinkonomy CreditAttribution: pinkonomy commentedI have the same issue,no energy is added when viewing a node.
Comment #3
jcam88 CreditAttribution: jcam88 commentedI am having a similar issue Drupal 7.23. No energy added when viewing a node that is displayed using Panels. Disabling the panel and energy is added. Is anyone using Radioactivity with panels?
Comment #4
pinkonomy CreditAttribution: pinkonomy commentedI finally managed to solve this adding a rule.
Comment #5
antpre CreditAttribution: antpre commentedSame problem here.
Comment #6
antpre CreditAttribution: antpre commentedWell actually this problem occurs with drupal 7.23 and 7.24.
Any plan for a release that fix this ?
Comment #7
pinkonomy CreditAttribution: pinkonomy commented@antpre: There is no need for a fix.You can create a rule that gives points when viewing content.
Cheers
Comment #8
antpre CreditAttribution: antpre commentedThanks. I ll try it... but my understanding is that the module is suppose to work properly out of the box. So guess there should be a release that fix the problem...
Bye
Comment #9
antpre CreditAttribution: antpre commentedOk so i managed to and incident with rules. But it adds energy when I view the node itself... but also if I view a page with a teaser of the node appearing in a list of content... Which I dont want.
With the module u would simply put 0 energy for the teaser that appear in a list. How to do that with rules...
Any help would be appreciated.
Thanks
PS : should the priority of this bug be higher as the module is not usable as such ????
Comment #10
antpre CreditAttribution: antpre commentedok I am raising the status (fell free to lower if I am wrong).
Same problem with the 7.x-2.8 and 7.x-2.x dev version.
Comment #11
tcmug CreditAttribution: tcmug commentedI haven't been unable to replicate this bug.
Please check that you are running Drupal cron at nice intervals. The field cache does not get cleared without it and Drupal keeps displaying the cached field state - this might explain the described situation.
Comment #12
tcmug CreditAttribution: tcmug commentedClosing issue!
Comment #13
adrien.felipe CreditAttribution: adrien.felipe commentedI ran cron and cleared the cache several times, no energy was ever given.
The only thing that made it work was the rule.
(I use panels to display the node and the radioactivity field)
Comment #14
vegantriathleteI can confirm that I can reproduce the issue when I am using Panels.
If I test this in an environment without panels, it works exactly as expected, given the setup. If I use the same setup in an environment that uses Panels, I experience the same problem that no energy is added. I agree that we should not have to use Rules to do this basic functionality. I don't know if the bug is in Panels or in this module. I will dig into it more.
Comment #15
jenlamptonI'm also having this issue, using panels and page manager, and no energy is ever added when viewing a node.
Things I tried to no avail:
* explicitly adding the Radioactivity field to the panel display
* adding the rendered node in "full" view mode to the panel display
* disabling the node view variant for this node type
* disabling the page manager handler for all nodes (node/%node)
* clearing all caches
* clearing the "page and else" cache (this clears cached fields)
* running cron
Will dig deeper to see if I can find out why it's not working...
Comment #16
jenlamptonupdating issue title.
Results of deeper digging: It looks like the function that is supposed to update the energy level when a node is viewed is
_radioactivity_update_energy()
and that function is only called two times in this module.One of those calls is in
radioactivity.rules.inc
which is why people have been able to get around this problem by setting up a Rule.The other call is in the
RadioactivityIncident
class, inincludes/RadioactivityIncident.inc
. I'm not sure why this incident isn't being triggered when the node is being viewed via page manager / panels, but will dig deeper.Comment #17
CBI believe Rules is server-side only isn't it? Those of us running Varnish are screwed because Rules never sees the request. The beauty of this field is that it fires with JS making it a much better candidate for a 'view' in my opinion.
Rules does have an action for adding the AJAX and maybe thats the best option.
Comment #18
jenlamptonI think the recommendation from @tcmug isn't correct, because according to the code, it looks like the field cache is cleared after each increase in energy. If the energy is being increased, you will see it right away when viewing the node.
Results of digging...
The
RadioactivityIncident
class is called in emit.php, which is hit with AJAX every time the field is viewed. (This is why it is necessary to enable the field under Manage Fields even if you configure it not to display a value).However, every time a node with this field is viewed, I get an error on emit.php:
Possibly related
* #2329081: Failed to load resource: the server responded with a status of 400 -- emit.php
* #1454406: Invalid post data - check configuration.
Comment #19
jenlamptonWell, that error was unrelated. That's now resolved, things are posting correctly to emit.php, and still the values in the radioactivity fields are not increasing when a node is viewed. :/ So, where the heck are these values supposed to increase?
Coming back full circle... we know this works with rules. So, looking in the rules code the function that is called is
_radioactivity_update_energy
. That function is also called inRadioactivityIncident.inc
inside the methodupdateEnergy
.Where is that called? Well, it looks like each storage class calls it. I'm using
LiveIncidentStorage
so let's start there...Let's see if that fires when the page is viewed. NO.
Let's see if it fires on cron. NO.
Well, there's a problem.
Comment #20
tcmug CreditAttribution: tcmug commentedHmm we had a similiar thing just now on a site using entitycache 1.1 could that be the cause?
Then some clarification regarding rules: rules are meant to be used to boost nodes energy, so for example when you write a comment on a node, you might want to boost it up a little bit in addition to boosting it when you've viewed it.
The boosting by viewing bit works via the field formatters, so whenever a radioactivity field is displayed it actually injects a bit of javascript which then gets triggered in in radioactivity JS beaviors and POSTed back to the server directly to emit.php. emit.php is then responsible for storing the data sent to whichever storage you have chosen for the field. Then at cron runs the data is processed and fed into the fields.
Anyhoo, I'm having a go at duplicating this now to see if I can give you ideas on how to solve it :)
Comment #21
tcmug CreditAttribution: tcmug commentedSorry but I was unable to replicate this still :(
Few points to look for:
Comment #22
patrickfwestonI also ran into this issue while trying to set up Radioactivity with a Panelized content type.
I have the Radioactivity field displayed (it's showing the correct, raw value for the radioactivity). However, viewing the page does not increase the energy of the page (the radioactivity decays properly). I've dug into the javascript that's included on the page, along with emit.php.
My problem seems to be stemming from the fact that
_radioactivity_checksum_validate
is failing in radioactivity-bootstrap.inc. Returning a value of true (instead of running the conditional check) causes the energy to be correctly incremented.I have verified that the POST to emit.php is returning an error. I'm getting:
400 (Bad Request edd7746c57c54ff857e65f0171d270f2 - 83372879a8f183cb6a120f52fbf97db5)
I modified the header to return _radioactivity_checksum_generate($data) and the $checksum from the _radioactivity_checksum_validate() function.
If you'd like me to dig around more in a certain area, I'd be happy to take a look. Thanks!
Update: It looks like this isn't the issue, as I've reset my configuration and have gotten rid of the 400 response. The energy for a node is still not be increased when it is viewed. I have tried with multiple storage types to no avail.
Comment #23
varshith CreditAttribution: varshith as a volunteer and commentedHi,
I am using drupal_commons which includes radioactivity within.
I am also using panels. In my case radioactivity was not updating energy at all (both in node-view and rules).
But when I clear my cache I could see a one step increase in energy (even if I view the node 10 times, the energy will only increase for 1 time on cache clear)
On debugging I found that the issue was due to entitycache module (also a part of drupal_commons).
Radioactivity updates the energy in DB and attempts to clear the field cache. But with entitycache, this is not cleared.
I have added a patch for this here
https://www.drupal.org/node/2795497