WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15338 closed defect (bug) (fixed)

Use global $current_screen within the List Tables classes

Reported by: westi Owned by: scribu
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

At the moment WP_List_Table caches a local copy of the screen object rather than using the pre-existing global.

This gives the potential for them to get out of sync.

We should just use the one location for this data.

Either always referencing the global or probably better using get_current_screen() in each function that needs the screen object.

Attachments (1)

15338.diff (11.3 KB) - added by scribu 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 scribu3 years ago

  • Owner set to scribu
  • Status changed from new to accepted

scribu3 years ago

comment:2 scribu3 years ago

  • Keywords has-patch added; needs-patch removed

Things to test:

  • the deprecated print_column_headers()
  • PHP4 compatibility: get_current_screen()->id

comment:3 scribu3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [16235]) Use get_current_screen() in list table classes. Fixes #15338

comment:4 westi3 years ago

Thank You!

Do we still need to pass $screen as an argument to the base class in deprecated.php?

comment:5 scribu3 years ago

Yes, because with register_column_headers() and print_column_headers() the screen can be different than the current screen.

See the WP E-Commerce plugin as an example.

comment:6 westi3 years ago

Ok.

Possibly worth a comment as to why in the code then :-)

Great work.

comment:7 scribu3 years ago

(In [16369]) Fix inline term editing. See #15338

comment:8 scribu3 years ago

(In [16371]) Fix post comments box and remove unused 'add-comment' ajax action. See #15338

Note: See TracTickets for help on using tickets.