Cookie comment life...
 
Notifications
Clear all

Cookie comment lifetime in seconds  

  RSS

Kalin
(@kaldata)
Member Customer
Joined: 3 years ago
Posts: 2
31/03/2020 5:36 pm  

I'm using a comment plugin wpDiscuz. When a guest adds a comment, the plugin adds two cookies:
comment_author_ and comment_author_email_ to remember the name and email of the user so they don't write them every time.

But then for wp-rocket this user is no longer a guest. And it stops loading the site from the cache for him. Until these two cookies are deleted, the cache does not work for him.

How do I set these cookies to lifetime 3 minutes?

In settings: Keep guest commenter credentials in browser cookies for x days

 

But the minimum is 1 day or 0 to clear those data when user closes browser.

 

Regards,


Quote
Elvina
(@elvina)
Prominent Member Moderator
Joined: 9 months ago
Posts: 966
01/04/2020 1:22 pm  

Hi @kaldata,

Please try to use the following code:

add_filter("wpdiscuz_js_options", function ($optionsJs) {
$optionsJs["storeCommenterData"] = (time() + 3 * MINUTE_IN_SECONDS) * 1000;
return $optionsJs;
});

You should add this code in the functions.php file of the current active theme.

Please don't forget to delete all caches and press CTRL+F5(twice) on the frontend before checking.


ReplyQuote
Kalin
(@kaldata)
Member Customer
Joined: 3 years ago
Posts: 2
01/04/2020 2:07 pm  

Hi, tahanks, 

I tried many times. I deleted caches, pressed f5, but no result. Every time creates cookies with lifetime: Session 🙁


ReplyQuote
Elvina
(@elvina)
Prominent Member Moderator
Joined: 9 months ago
Posts: 966
01/04/2020 3:44 pm  

@kaldata,

The code provide above work only partly.

I'm sorry but we can't provide an exact solution for that, because for the cookie we use the js lib, that allows to set cookie only by days(not hours/ minutes and etc).

 


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 4107
02/04/2020 2:27 pm  

Hi @kaldata,

Currently, there is no solution we can provide you. However, we'll take this into consideration and may implement it in future updates if it'll be possible. 


ReplyQuote
Share: