Skip to:

Opened 4 weeks ago

Last modified 3 weeks ago

#3354 assigned defect

Theme compatibility and problem with 'get_adjacent_post()' function

Reported by: GDragoN Owned by: johnjamesjacoby
Milestone: 2.6.5 Priority: high
Severity: major Version: trunk
Component: Appearance - Theme Compatibility Keywords: has-patch 2nd-opinion


Some themes (including many default Twenty* themes) show adjacent links to all posts, and in theme compatibility mode that breaks because function get_adjacent_post() expects post to have valid post_date. But, In theme compatibility mode, bbPress uses 'bbp_theme_compat_reset_post()' function and it sets post_date to 0.

Why is that done at all, when we can set post_date to proper post_date for the single topic, reply or forum we are generating compatibility post? Is there any concrete reason for why the post_date has to be 0 in theme compatibility mode or was it just some random decision not to set it?

I have attached the patch that adds date to theme compatibility reset for single topic, forum and reply.

Attachments (1)

3354_theme-compat.php (1.8 KB) - added by GDragoN 4 weeks ago.

Download all attachments as: .zip

Change History (4)

#1 @GDragoN
4 weeks ago

Also, few months ago I have noticed some other issues (not just get_adjacent_post()) related to compatibility mode and the missing post_date.

#2 @johnjamesjacoby
3 weeks ago

  • Keywords has-patch 2nd-opinion added
  • Milestone changed from Awaiting Review to 2.6.5
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

Related to #3337.

I think it makes sense to correctly format datetime column values rather than have them simply be false. We could probably get away with 0000-00-00 00:00:00 because WordPress forced zero dates to be allowed in MySQL, but I do suspect this is going to go away someday, so perhaps Unix Epoch makes more sense, or maybe some other value.

#3 @GDragoN
3 weeks ago

Yeah, we can have '0000-00-00 00:00:00' instead of 0, but I think we should use the real dates when available (as my patch does) because there were some cases in the past that I noticed as a problem related to some other plugins.

Note: See TracTickets for help on using tickets.