Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#19932 closed enhancement (fixed)

Pass post ID to post revision field filter

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

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 15 years ago.
Add post ID to revision field filter
revisions-whole.diff​ (938 bytes ) - added by pollett 15 years ago.
Pass complete revision to revision field filter
19932.1.patch​ (1.2 KB ) - added by ethitter 14 years ago.

Download all attachments as: .zip

Change History (10)

@pollett
15 years ago

Add post ID to revision field filter

#1 @scribu
15 years ago

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

@pollett
15 years ago

Pass complete revision to revision field filter

#2 @pollett
15 years ago

Passing the whole revision seems fairly reasonable. Patch added.

#3 @westi
14 years ago

  • Keywords revisions-3.6 added

Adding as a candidate for the Revisions work in 3.6

#4 @westi
14 years ago

  • Keywords revisions-3.6 removed
  • Milestone Awaiting Review → 3.6

@ethitter
14 years ago

#5 @ethitter
14 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
14 years ago

  • Cc adamsilverstein@… added

looks good.

#7 @westi
14 years ago

  • Owner set to westi
  • Resolution → fixed
  • Status new → 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.