By GM on Monday, 07 August 2017
Posted in General
Replies 11
Likes 0
Views 600
Votes 0
Hello,

Due to cache enabled, facing some issues wherein token is cached on submitting comment by guest user in easyblog
I guess this file -JoomlaFolder/components/com_easyblog/views/comments/view.ajax.php

The best advise i got is to refresh the page after comment is successfully submitted (so that new cache is cleared on page load).
But which is the actual ajax call files which manages comment so that the callback function that handles any responses from the server.

How to use window.location.reload(true); in callback function
Can you pl advise how to refresh page after comment successfully submitted in blog post
You have to add that code into this js file JoomalFolder/media/com_easyblog/scripts/site/comments/form.js


// line 209 - 216
EasyBlog.ajax('site/views/comments/save', data)
.done(function(output, message, state) {

self.setNotice(message, state);
self.trigger('commentAdded',[output, data]);

})


Replace with,


EasyBlog.ajax('site/views/comments/save', data)
.done(function(output, message, state) {

self.setNotice(message, state);
self.trigger('commentAdded',[output, data]);
window.location.reload(true);

})


Since this is under js file, it will not work unless you recompile the Easysocial all the existing script again, so this changes only applied on these compiled script file.

To recompile Easyblog script, you have to login as Superadmin user account on frontend, then run this following URL on your browser.
[gist type="php"]
http://yourdomain.com/index.php?option=com_easyblog&compile=1&minify=1
[/gist]
·
Monday, 07 August 2017 12:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks
is there any other way to recompile scripts as testing on wamp server showing - 0 - No HTTP response from server
GM
·
Monday, 07 August 2017 13:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Try download my attached file and replace into JoomlaFolder/administrator/components/com_easyblog/includes/compiler/closure.php and see is it able to recompile?
·
Monday, 07 August 2017 13:21
·
0 Likes
·
0 Votes
·
0 Comments
·
but i have
JoomlaFolder/administrator/components/com_easyblog/includes/compiler/complier.php

my easyblog version is 5.0.37
GM
·
Monday, 07 August 2017 13:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Since you still using older version of Easyblog, try my following instruction and see how it goes.

1. Modified the file but older version of Easyblog is located this file -> JoomlaFolder/media/com_easyblog/scripts/comments/form.js


// LINE 211 - 217
EasyBlog.ajax('site/views/comments/save', data)
.done(function(output, message, state) {

self.setNotice(message, state);
self.trigger('commentAdded',[output, data]);
})


Replace with


// LINE 211 - 217
EasyBlog.ajax('site/views/comments/save', data)
.done(function(output, message, state) {

self.setNotice(message, state);
self.trigger('commentAdded',[output, data]);
window.location.reload(true);
})


2. Once you done this, you can try switch your Easyblog environment mode to development from backend > Easyblog > setting > system

3. If your site has enabled cached system, can you temporary disabled it and clear all the cache.
Then try add new comment and see whether will auto refresh the page after submitted the comment.

4. If everything okay, then try modified this file :
JoomlaFolder\media\foundry\5.0\libraries\closure.php


// LINE 33
const URL = 'http://deployer.stackideas.com:1280';

//replace with

const URL = 'http://oauth.stackideas.com/compiler';


5. To recompile Easyblog script, you have to login as Superadmin user account on frontend, then run this following URL on your browser.
[gist type="php"]
http://yourdomain.com/index.php?option=com_easyblog&compile=1&minify=1
[/gist]

6. Once recompile completed, then switch back to production mode and test submit new comment.

7. If work, then re-enabled back the cache system from backend.
·
Monday, 07 August 2017 15:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Great i followed step by step
However on step 5 when recompiling its showing error
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting ',' or ';' in C:\wamp\www\mycar17jan2017\media\foundry\5.0\libraries\closure.php on line 42
GM
·
Monday, 07 August 2017 18:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Try attach this closure.php file, it seems like there got any invalid code.
·
Monday, 07 August 2017 18:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi no attachment,
can you attach file pl
GM
·
Monday, 07 August 2017 19:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Oh, I am sorry for the confusing in earlier, what i mean is attach your closure.php file so we can help you correct it.

It okay, I already attached my file, can you try replace into that file location and see how it goes?
·
Monday, 07 August 2017 19:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Appreciate your detailed assistance on it
But while testing on wamp - on recompling - getting error no http response from server
GM
·
Tuesday, 08 August 2017 12:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, that was strange.

By the way, try open this file -> JoomlaFolder/media/com_easyblog/scripts/site-5.0.37.static.min.js

And try search this keyword site/views/comments/save and insert these code window.location.reload(!0) after the b.trigger("commentAdded",[a,f]), , you can refer on my attached screenshot below.

Hope this will help.
·
Tuesday, 08 August 2017 12:48
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post