Is session favorites module designed to work with anonymous users and cached pages? I have several problems with the module that may have started when I turned caching on. For example the page listing the personal favorites is cached. After I forced caching off in _session_favorites_page() the page is no longer in {cache_page}.

CommentFileSizeAuthor
#1 session_favorites.359302.patch3.97 KBsutharsan

Comments

sutharsan’s picture

Category: support » feature
Status: Active » Needs review
StatusFileSize
new3.97 KB

I have been able to add the required code to get session_favorites working (better) with anonymous users. A patch is attached.
The addition of $GLOBALS['conf']['cache'] = FALSE; looks a bit hacky to me, but it sure works to prevent caching of the favorites page.

jhedstrom’s picture

Thanks Sutharsan. The idea of the patch sounds great, but the attached patch appears to be for UI/javascript-related changes. Am I missing something?

sutharsan’s picture

The patch does two things: the above mentioned prevention of caching and it adds an Ajax call upon page load calling favorit_path/js/get that updates the favorit link based on the node's favorit status.

brian_c’s picture

Rather defeats the purpose of caching, if every node view now triggers a server-side AJAX call that Drupal needs to fully process.

To really make Session Favorites work efficiently for cached sites, I think the best solution would be to store favorites locally in a cookie, then JS can modify the page based on the cookie, without needing a server hit.