I'm able to view Disqus comments on content types I've selected when logged into Drupal as an Authenticated user, but when I visit the same content as Anonymous, Disqus comments are not loaded and this noscript block of code gets written out:
<div id="disqus_thread">
<noscript><p><a href="[url]">View the discussion thread.</a></p></noscript>
</div>
I confirmed that all Permissions are set correctly for Anon to be able to view disqus comments and I turned off all caching and JS aggregation.
I found this comment in disqus.module line 779: "Prepares the noscript tag which is used when JavaScript is not available.", where function theme_disqus_noscript
returns this noscript
tag.
I confirmed that while I'm Authenticated, sites/all/modules/contrib/disqus/disqus.js
gets loaded, but when I'm Anonymous this file does not get loaded. Even though doing a var_dump($element)
in function disqus_element_post_render
shows that the disqus.js
is getting stored in $element['#attached']['js'][]
for BOTH Authenticated and Anonymous with all caches cleared.
I'm not sure what is stopping disqus.js from loading for Anonymous users and how else can I get it to load?
Comments
Comment #1
slashrsm CreditAttribution: slashrsm commentedHave you tried to clear caches? Does it happen with JS aggregation enabled or disabled?
Comment #2
wesleymusgrove CreditAttribution: wesleymusgrove commentedYes I have cleared all caches and disabled all block and page caching. Turning off/on JS aggregation doesn't change anything.
This was happening on the 7.x-1.9 branch as well as the 7.x-1.x-dev. I duplicated the issue on two separate installs.
Comment #3
wesleymusgrove CreditAttribution: wesleymusgrove commentedThis issue has been resolved. I had a hook implementation in template.php that I forgot about which removes javascript for anonymous users, as I have a custom implementation that loads javascript dependencies after the DOM finishes loading.
I temporarily removed this function and confirmed that disqus.js loads for anonymous users. However it is not loaded after the page loads, which wasn't satisfactory for my project. My final solution was to abandon use of the module and incorporate Disqus' universal embed code into my postloaded javascript solution.