Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34138 closed defect (bug) (fixed)

Customizer: Missing comments in Recent Comments widget

Reported by: pavelevap Owned by: boonebgorges
Priority: normal Milestone: 4.4
Component: Customize Version: 4.3
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

When you add "Recent Comments" widget in Customizer, you will see only title "Recent comments", but no comments.

Attachments (2)

34138.patch​ (871 bytes ) - added by rommelxcastro 11 years ago.
fallback to get_comment
341381.patch​ (879 bytes ) - added by rommelxcastro 11 years ago.
comments duplicated issue fixed

Download all attachments as: .zip

Change History (11)

#1 @westonruter
11 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → 4.4
  • Version trunk → 4.3

Confirmed. The Recent Comments widget lists comments as expected in 4.3, but in trunk the call to get_comments() in WP_Widget_Recent_Comments::widget() returns an empty array when called in the context of the Customizer preview.

@rachelbaker Any thoughts here?

#2 @rommelxcastro
11 years ago

  • Keywords 2nd-opinion dev-feedback added

hello, after debugging this i have found the issue.

on preview mode on class-wp-widget:344, wp_suspend_cache_addition is defined to true, so when _prime_comment_caches is called on class-wp-comment-query:410 comments can't be added to cache.

@rommelxcastro
11 years ago

fallback to get_comment

#3 @rommelxcastro
11 years ago

  • Keywords needs-patch removed

#4 @stevehenty
11 years ago

Hi @rommelxcastro, I'm seeing comments duplicated in the widget with 34138.patch

@rommelxcastro
11 years ago

comments duplicated issue fixed

#5 @rommelxcastro
11 years ago

new patch added, thanks @tevehenty

#6 @wonderboymusic
11 years ago

  • Keywords has-patch added; 2nd-opinion dev-feedback removed
  • Owner set to boonebgorges
  • Status new → assigned

I think this touches upon your oeuvre

#7 @stevehenty
11 years ago

@rommelxcastro with 341381.patch the comments appear correctly.

#8 @boonebgorges
11 years ago

Good catch. We can simplify this by just calling get_comment(), which will grab from the cache or the database as necessary.

#9 @boonebgorges
11 years ago

  • Resolution → fixed
  • Status assigned → closed

In 35512:

WP_Comment_Query: Fill comment objects from database when cache is unavailable.

This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a wp_suspend_cache_addition() block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.

Note: See TracTickets for help on using tickets.