Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#15338 closed defect (bug) (fixed)

Use global $current_screen within the List Tables classes

Reported by: westi's profile westi Owned by: scribu's profile 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 14 years ago.

Download all attachments as: .zip

Change History (9)

#1 @scribu
14 years ago

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

@scribu
14 years ago

#2 @scribu
14 years ago

  • Keywords has-patch added; needs-patch removed

Things to test:

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

#3 @scribu
14 years ago

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

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

#4 @westi
14 years ago

Thank You!

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

#5 @scribu
14 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.

#6 @westi
14 years ago

Ok.

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

Great work.

#7 @scribu
14 years ago

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

#8 @scribu
14 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.