Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21042 closed defect (bug) (wontfix)

Plugins' implementation of "Number of Columns" screen option broken

Reported by: djpaul's profile DJPaul Owned by: azaozz's profile azaozz
Milestone: Priority: low
Severity: normal Version: 3.4
Component: Administration Keywords: close
Focuses: Cc:


Plugins that have implemented the "Number of columns" screen option by copy/pasting the implementation from the edit-form-advanced.php template are broken in 3.4.

Examples of affected plugins are BuddyPress 1.6 beta 1, and AVH Extended Categories Widgets v3.6.4. To recreate, load up either of these plugins' admin screens and try changing the "Number of Columns" screen option. Nothing happens. No javascript errors reported in the browser.

This was introduced by r20272, where the $screen_layout_columns stuff was moved from #poststuff to #post-body.

While this is part of core that has been copy/pasted due to the functionality being unable to be implemented via a central helper method (or the like), could consideration be given to a backpat fix, perhaps via javascript?

Attachments (2)

my-script.js (1.2 KB) - added by azaozz 12 years ago.
my-script-2.js (1.2 KB) - added by azaozz 12 years ago.

Download all attachments as: .zip

Change History (14)

#1 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to 3.4.1

#2 @azaozz
12 years ago

As the reporter said this is part of the Edit Post screen, not an API intended for use by plugins. If some plugins have copied the way it works on that screen, perhaps they should update to use more "independent" method.

Best would be to abstract it into an API, don't think this should be in 3.4.1 though.

#3 follow-up: @nacin
12 years ago

  • Priority changed from normal to low

Is there anything we can do to make [20272] compatible with existing plugin usage, via a few extra CSS declaration blocks or something similar?

#4 @nacin
12 years ago

  • Owner set to azaozz
  • Status changed from new to assigned

#5 in reply to: ↑ 3 @azaozz
12 years ago

Replying to nacin:

Is there anything we can do to make [20272] compatible with existing plugin usage...

The old structural css wasn't removed despite that it's not used in core any more, so plugins using that layout would not break. To keep columns switching working the "old" way, the old JS would need to be restored too.

The bigger problem here is: how long should we keep supporting plugins that copy something from core, and would they switch to using more "independent" methods if the old method still works?

12 years ago

#6 @azaozz
12 years ago

  • Keywords close added

Best would be if these plugins implement something like my-script.js above until column switching is abstracted into an API.

#7 @johnjamesjacoby
12 years ago

Anyone that copies code out of files in wp-admin literally gets what they paid for. Short term, I think it's up to plugin authors to keep up with WordPress core when we/they use code without trusted conventions. Long term, this specific nook needs a trusted convention so plugins can avoid this situation in the future.

#8 @nacin
12 years ago

  • Milestone changed from 3.4.1 to 3.4.2

#9 @diegotdai
12 years ago

  • Cc diegotdai added

On line 11 $('.postbox-container:visible').lengt; is missing h for length?

var n = parseInt($(this).val(), ps = $('#poststuff'), visible = $('.postbox-container:visible').lengt;

12 years ago

#10 @azaozz
12 years ago

Fixed a typo in the example script, thanks @diegotdai.

#11 @azaozz
12 years ago

  • Resolution set to wontfix
  • Status changed from assigned to closed

Thinking that all plugins that have copied this code are updated by now. Also: best handled in the individual plugins.

#12 @SergeyBiryukov
12 years ago

  • Milestone 3.4.2 deleted
Note: See TracTickets for help on using tickets.