The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Missing argument in...
 
Share:
Notifications
Clear all

[Solved] Missing argument in _getWPComments causes wrong comments in combiation with redis plugins

24 Posts
6 Users
3 Likes
2,259 Views
Posts: 4
 BenK
Topic starter
(@benk)
Active Member
Joined: 4 years ago

Hello,

since the major update an wpDiscuz 7.x there is an error within the method _getWPComments of the file /wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php

In case of non paging comments the array $this->commentsArgs haven't an argument offset like in version 5.3.5.

This missing argument is relavant for the creation of the redis key within WordPress core method get_comments within WordPress core class class-wp-comment-query.php:

$_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
unset( $_args['fields'] );
$key = md5( serialize( $_args ) );
$last_changed = wp_cache_get_last_changed( 'comment' );
$cache_key = "get_comments:$key:$last_changed";
$cache_value = wp_cache_get( $cache_key, 'comment' );

See also:
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-comment-query.php#L429

If your WordPress uses a redis plugin like Redis Object Cache and you will click on the "Load more comments" Button, the same initial comments will be loaded.

Many enterprise bussiness sites based on WordPress are using caching, so please fix this issues.

Best regards,
Ben

23 Replies
Asti
Posts: 7098
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

@benk,

We'll take this into consideration for future updates. 

Posts: 6
(@bekind)
Active Member
Joined: 3 years ago

Hi @asti - I am having the exact same issue and we are too invested in wpdiscuz as well as redis so we cannot afford to remove either. My developers modified the file pointed by @benk to get "Load More" to work correctly. But that is obviously incorrect.

Can you please share when the solution to this issue is expeced? The way we use wpdisuz makes redis important as we get sudden traffic + comment spikes and redis cache helps us manage our infrastructure.

Regards

Posts: 6
(@bekind)
Active Member
Joined: 3 years ago

Hi @asti - Any update on this. We accidentally broke wp comments during Wordpress Upgrade due to this issue. It's kind of critical for sites that heavily use wp comments. Kindly let me know when we can expect a fix here.

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 6 years ago

Illustrious Member
Posts: 7098

@bekind,

We've added the wpdiscuz_filter_args hook. You can use the hook and make the caches you like. More info here: https://wpdiscuz.com/docs/codex/filters/wpdiscuz_filter_args/

Posts: 22
(@willybob)
Eminent Member
Joined: 4 years ago

I'm intetrested in this solution as I have exactly the same issue.

But I still don't get how those hooks would solve the problem...

Posts: 6
(@bekind)
Active Member
Joined: 3 years ago

Hi @willybob,

What they are recommending is that we add the pagination parameter in the argument using the hook. The fundamental issue here is that Wordpress core is expecting a parameter "offset" as pointing by OP. But WpDiscuz doesnt have that parameter.

So essentially, one needs to figure out what parameter is used by Wpdiscuz for AJAX pagination and then map that parameter to offset parameter. If we filter the argument that way then the core would be able to create a unique key per page and the solution would behave as expected.

I havent had time to work on this else I would have shared the solution but I do understand what is the issue hence sharing my thoughts. If you happen to make progress, please share so all of us can use the solution. If I get to it before you 🙂 then I would share.

Regards 

Posts: 22
(@willybob)
Eminent Member
Joined: 4 years ago

I will, do not hesitate to share any progress too. 

Page 1 / 2
Share: