Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#19932 closed enhancement (fixed)

Pass post ID to post revision field filter

Reported by: pollett's profile pollett Owned by: westi's profile westi
Milestone: 3.6 Priority: normal
Severity: minor Version:
Component: Revisions Keywords: has-patch
Focuses: Cc:

Description

When viewing a post revision, for each field the filter

_wp_post_revision_field_xx

is called. This is passed the field name and value as parameters but not the post ID that it's working with, this allows you to modify the value based on it's currently contents but not based on the post ID i.e. to inject new fields into the diff.

Proposal that the post ID also be passed to this filter rather than having to hack around it by making $left and $right global.

Attachments (3)

revisions.patch (946 bytes) - added by pollett 13 years ago.
Add post ID to revision field filter
revisions-whole.diff (938 bytes) - added by pollett 13 years ago.
Pass complete revision to revision field filter
19932.1.patch (1.2 KB) - added by ethitter 12 years ago.

Download all attachments as: .zip

Change History (10)

@pollett
13 years ago

Add post ID to revision field filter

#1 @scribu
13 years ago

Why not pass the whole revision instead of just the ID, then?

@pollett
13 years ago

Pass complete revision to revision field filter

#2 @pollett
13 years ago

Passing the whole revision seems fairly reasonable. Patch added.

#3 @westi
12 years ago

  • Keywords revisions-3.6 added

Adding as a candidate for the Revisions work in 3.6

#4 @westi
12 years ago

  • Keywords revisions-3.6 removed
  • Milestone changed from Awaiting Review to 3.6

@ethitter
12 years ago

#5 @ethitter
12 years ago

  • Cc erick@… added

In 19932.1.patch, I refreshed the patch and added the entire revision to the third instance of the filter. I also added the revision side to the uses, or an empty string when not in a diff.

#6 @adamsilverstein
12 years ago

  • Cc adamsilverstein@… added

looks good.

#7 @westi
12 years ago

  • Owner set to westi
  • Resolution set to fixed
  • Status changed from new to closed

In 23404:

Revisions: Pass the whole revision being filtered along with context about which side it is to the _wp_post_revision_field_$field filters.

Fixes #19932 props pollett, ethitter.

Note: See TracTickets for help on using tickets.