Opened 5 years ago
Closed 4 years ago
#3354 closed defect (bug) (fixed)
Theme compatibility and problem with 'get_adjacent_post()' function
Reported by: | GDragoN | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6.6 | Priority: | high |
Severity: | major | Version: | trunk |
Component: | Appearance - Theme Compatibility | Keywords: | has-patch 2nd-opinion |
Cc: |
Description
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 (2)
Change History (11)
#2
@
5 years 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
@
5 years 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.
#6
@
4 years ago
I think the issue with using "real dates" is that in some instances, like User Profile pages, there isn't a datetime value to guess from.
The only other potential regression I can imagine but cannot find happening, is anyplace something like:
empty( $post->post_date )
...might be used.
Thank you @GDragoN for the patch. I think I'm going to go a slightly different route. Would love if you'd be willing and able to check it out sometime soonish.
#7
@
4 years ago
Yeah, this would be good. The filter can be used to return real date instead of the 0 date/time, because I think I remember some cases when such date/time also causes issues, I tried that at one point. Maybe the current date/time instead of zero by default would be better. But, this is a good solution.
Also, few months ago I have noticed some other issues (not just get_adjacent_post()) related to compatibility mode and the missing post_date.