By GM on Tuesday, 13 June 2017
Posted in Technical Issues
Replies 24
Likes 0
Views 624
Votes 0
Hello,

There is some problem with caching in Easyblog comment causing json error
While caching is disabled, any guest user can post comment but when cache is enabled - at submission comes json error

i really need a solution to disable cache in easyblog comment, Is there a way so that while the default comment system in easyblog - the cache can be disabled in while loading comment or submitting comment
any line of codes so that comment should not be cached
Unfortunately that was not possible to disabled cache from the comment section, unless your current cache system can able to exclude some of the component do not cache it on the page.

Perhaps you can share with us which kind of cache system you using?

And is it possible provide us with your Joomla backend and FTP access so we can better have a look?
·
Wednesday, 14 June 2017 10:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

i have jotcache enabled
It has exclude paramater of views and query
Details on - http://kbase.jotcomponents.net/jotcache/help/v53j3x/url-rules

See i am highlighting the issue and helping you replicating same)
As cache is enabled
You open any blog post - say this
http://www.mycarhelpline.com/index.php?option=com_easyblog&view=entry&id=474&Itemid=91

make a comment
Now open this blog post in new browser (not in same browser (as it is like a new visitor on page with same url)
http://www.mycarhelpline.com/index.php?option=com_easyblog&view=entry&id=474&Itemid=91

Now - make a comment
you wont able to do so showing json error when submit

Is there a solution for you to provide on either query so which comments may not be cached
or solutuion for json error when cache is enabled

I have tsted on easyblog on localhost wamp and its showing the same error when cache enabled

However - when cache is disabled or a registered user is posting comment - then there is absolute no issue in it
It seems that due to cache - the issue happening
GM
·
Thursday, 15 June 2017 09:25
·
0 Likes
·
0 Votes
·
0 Comments
·
Currently I do not have any solution yet and that error is actually show up "Invalid token" which mean that your cache system already cached the access token on the page, so it unable to generate another new token for another user to submit comment.

Perhaps you can update your Joomla backend and FTP access so I can better have a check whether we can do something after user commented then clear the cache automatically
·
Thursday, 15 June 2017 12:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex

Do you foresee a same problem in the latest easyblog version ?
am presently on 5.0.37, If can confirm that the latest blog version can post in comment with the cache enabled - i may go for update of eb to latest version

other deatils joomla version is 3.6.2

While i check - the same problem is not in easydiscuss - there it works easily whether even cache is enabled, the new user can easily post in question

as both component belongs to you - is token system different in both easyblog and easydiscuss
GM
·
Thursday, 15 June 2017 12:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Also Arlex
Adding a reply before you comment on it
I have cache cleaner also installed which cleans cache on site on periodic interval
In it there is an option to clean cache when specific tasks are performed like - save, apply, submit
attached screenshot

In blog - for submitting comment - is the task different from save,apply,submit
see attached screenshot pls

If yes - could you tell task - which i can add in it and probably cache can be cleared when specific action is performed on front end comment submitting
GM
·
Thursday, 15 June 2017 12:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Do you foresee a same problem in the latest easyblog version ?
am presently on 5.0.37, If can confirm that the latest blog version can post in comment with the cache enabled - i may go for update of eb to latest version

I believe it will same problem because between that Easyblog version we do not have fix something related these cache thing.
And I do not have jotcache plugin so I can't replicate this issue in my locally.

other deatils joomla version is 3.6.2
While i check - the same problem is not in easydiscuss - there it works easily whether even cache is enabled, the new user can easily post in question

as both component belongs to you - is token system different in both easyblog and easydiscuss

This one have to troubleshoot this on your site and see what is the different between both component, i believe one of the different is when you post a new question, it actually after submit the post it will refresh the page, when you submit a comment, it actually just populate the output without refresh the page.


Also Arlex
Adding a reply before you comment on it
I have cache cleaner also installed which cleans cache on site on periodic interval
In it there is an option to clean cache when specific tasks are performed like - save, apply, submit
attached screenshot

In blog - for submitting comment - is the task different from save,apply,submit
see attached screenshot pls

If yes - could you tell task - which i can add in it and probably cache can be cleared when specific action is performed on front end comment submitting

Based on what i check the code, it seems like our comment also using 'save' function, but i am not sure that 'clean on task' option is it support ajax function? Because the comment save is go through the ajax call.
·
Thursday, 15 June 2017 13:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Then Arlex
Pl find a solution to the cache thing, its a bug in component !!
here in you can download Jotcache component,
http://www.jotcomponents.net/home/web-programming/jotcache/download/jotcache-download-jotcache-5-3

may be you can test it when cache is enabled on your component on your dummy site - so that the comment can be submitted in. A solution would not only be great for me - but for community users using cache and easyblog

Been experts of programming and development field - i sincerely hope to come up with a solution of this cache thing pls - so that the comment can be easily submitted in for guest users
GM
·
Thursday, 15 June 2017 13:48
·
0 Likes
·
0 Votes
·
0 Comments
·
I would said this is NOT the component bug and that is NOT cache system fault as well.

The reason why we need to add those tokens into the submit form is because those tokens have to prevent these CSRF Attack, you can read more this following reference link : https://docs.joomla.org/How_to_add_CSRF_anti-spoofing_to_forms

Based on what i tested in my locally after enabled that jotCache plugin, it seems like that issue only happening on guest user, i did tried following step to test whether can replicate that issue again when i logged in :
1. login one of the user account at Browser A and try comment multiple times -> it work
2. login same user account at another browser B and try comment multiple times -> it seems work fine as well.

By the way, that is not only cache system can only increase site performance because if all the HTML content already cached by 3rd party cache system, all the upcoming new status will not appear on the page immediately if the page already get cached in certain time.

I would suggest change to use mod_pagespeed from your server, it's actually an apache / nginx module that can be used to compress and minify a page on the web server's layer without compromising performance of php.

Then enabled Gzip compression from backend, it will reduces the file size of all scripts and css files being rendered on the page.

You can read more about mod_pagespeed from https://developers.google.com/speed/pagespeed/module/

If you still think that is not good option for this, you can remove this line of code from this file.
JoomlaFolder/components/com_easyblog/views/comments/view.ajax.php

// LINE 27
EB::checkToken();


But I am not really encourage you do this.
·
Thursday, 15 June 2017 18:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hai Arlex

Thanks, appreciate in, will certainly incorporate suggestion
I understand that token is necessary to check for csrf issue

As been expert in coding and development, may i suggest to incorporate 2 option for site owner to add comment
1. through present ajax (ideal for those not having cache enabled)
2. not use ajax and refresh / redirect the page on submit (as what happening in easydiscuss) so that people who are using cache and cache cleaner can have a new token been generated.
may be could help for site owners using cache as component

I appreciate once again for your kind patience and answer in, may be a permanent solution could be the best way to manage this.
GM
·
Thursday, 15 June 2017 19:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hai Arlex

Thanks, appreciate in, will certainly incorporate suggestion
I understand that token is necessary to check for csrf issue

As been expert in coding and development, may i suggest to incorporate 2 option for site owner to add comment
1. through present ajax (ideal for those not having cache enabled)
2. not use ajax and refresh / redirect the page on submit (as what happening in easydiscuss) so that people who are using cache and cache cleaner can have a new token been generated.
may be could help for site owners using cache as component

I appreciate once again for your kind patience and answer in, may be a permanent solution could be the best way to manage this.
If can add this to tracker for potentially the next release incorporating this could be awesome
GM
·
Thursday, 15 June 2017 19:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Hai Arlex

Thanks, appreciate in, will certainly incorporate suggestion
I understand that token is necessary to check for csrf issue

As been expert in coding and development, may i suggest to incorporate 2 option for site owner to add comment
1. through present ajax (ideal for those not having cache enabled)
2. not use ajax and refresh / redirect the page on submit (as what happening in easydiscuss) so that people who are using cache and cache cleaner can have a new token been generated.
may be could help for site owners using cache as component

I appreciate once again for your kind patience and answer in, may be a permanent solution could be the best way to manage this.
If can add this to tracker for potentially the next release incorporating this could be awesome
GM
·
Thursday, 15 June 2017 19:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your input.
·
Friday, 16 June 2017 13:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

I am in touch with Peter - developer of cache cleaner - where the component cleans cache on frontend tasks like save, publish, submit

I believe he would had also contacted either you or Mark for the component version
This is what he states


As far as I can tell the ajax call from the comments form does not have an input task attached to it, like Joomla has with stuff like save and apply.

The tasks you place in the Cache Cleaner tasks field are matched to the value from:

JFactory::getApplication()->input->get('task')

This is empty in the case of the the EasyBlog comments form.


Can you update in code so that Easyblog comment form can add input task as what based on Joomla adopts
can you pl see if can be done - as this can prevent unnecessary token error in cache enabled site - been submission will clear cache using this component

Peter also posed his comment

You could try and add a hidden form element with a task name (and value save) to that comment form.
And see if that doesn't mess the functionality up. Good chance EasyBlog will ignore it. But it should trigger Cache Cleaner.

You could do this via template overrides. StackIdeas support could probably help you with that and tell you if this is an ok approach.


Can you advise in to achieve the desired
GM
·
Sunday, 18 June 2017 01:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Try download my attached file and replace into this following and files location :


JoomlaFolder/media/com_easyblog/scripts/comments/form.js
JoomlaFolder/media/foundry/5.0/libraries/closure.php
JoomlaFolder/components/com_easyblog/themes/wireframe/comments/form.php


Then login as Superadmin user account and run this recompile Javascript URL on browser :

http://yoursite.com/index.php?option=com_easyblog&compile=1&minify=1


Note : these changes files only compatible with your current EB version 5.0.3x.
·
Monday, 19 June 2017 12:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi
Installed Version: 5.0.37
is the changes apt for the version
GM
·
Monday, 19 June 2017 16:48
·
0 Likes
·
0 Votes
·
0 Comments
·
As long as the version below the 5.0.44, it should be able to replace the file directly as what i described at my previous reply, but you have to backup the original file before you replace.

And remember follow my instruction at above after you replace the files on your site, these patch files is included save task hidden input on comment form.
·
Monday, 19 June 2017 23:02
·
0 Likes
·
0 Votes
·
0 Comments
·
replaced files
Logged in as superadmin,
compile by typing url
but getting error as no http response from server
Attached
GM
·
Tuesday, 20 June 2017 12:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm that was strange, Can you try temporary switch your system environment mode to development and see that comment stuff is it work?

Once you turn on to development mode, you do not need to recompile the script on the site.
·
Tuesday, 20 June 2017 15:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Regret bumping to 5 yr old thread
Wondering if this cache issue is addressed in latest versions of EB comments

"Json error actually show up - which mean that cache system already cached the access token on the page, so it unable to generate another new token for another user to submit comment."
GM
·
Wednesday, 16 November 2022 16:19
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, we already addressed this in the current latest version of Easyblog, it shouldn't happen if you enable the Joomla cache system.
·
Wednesday, 16 November 2022 16:58
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post