Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #17370, comment 6


Ignore:
Timestamp:
10/03/2022 12:10:08 PM (3 years ago)
Author:
TobiasBg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17370, comment 6

    initial v1  
    22
    33The change should not be difficult, and it should not bring backwards compat issues.
    4 In fact, this change had been made in the past at one point already. I went don't the rabbit hole on this a bit, focussing on the `closedpostboxes_$page` setting for now:
     4In fact, this change had been made in the past at one point already. I went down the rabbit hole on this a bit, focussing on the `closedpostboxes_$page` setting for now:
    55- Essentially, there's a "setter" `wp_ajax_closed_postboxes()` and a "getter" `postbox_classes()` for this option, no other code seems to be interacting with it.
    6 - Both were introduced in [6584], before WP 3.0 multisite merge (thus the problem didn't exist back then).
     6- Both were introduced in [6584], before WP 3.0 multisite merge (thus, the problem didn't exist back then).
    77- In [9871], this was inadvertently changed in the "getter" `postbox_classes()`, so that suddenly with the multisite merge in WP 3.0, it would be compatible to per-user per-site settings, in addition to the existing per-user only setting.
    88- In #12439, non-saving of the settings was observed, with [13551] actually turning this setting into a per-user per-site setting (without fully noticing it, it seems).
     
    1111
    1212So, in summary, the "getter" `postbox_classes()` is ready to use both the per-user per-site setting as well as the per-user only setting (as a fallback), thanks to using `get_user_option()`.
    13 This means that changing the "setter" `wp_ajax_closed_postboxes()` to use a per-user per-site setting is possible, without breaking backwards compatibility (the existing per-user setting will be used on all sites where no new per-user per-site setting has been saved). There will be a behavioral change though, that in worst case would mean that user has to change/adjust metabox visibility/state on multiple sites of a network, instead of just once.
     13This means that changing the "setter" `wp_ajax_closed_postboxes()` to use a per-user per-site setting is possible, without breaking backwards compatibility (the existing per-user setting will be used on all sites where no new per-user per-site setting has been saved). There will be a behavioral change though, that in worst case would mean that a user has to change/adjust metabox visibility/state on multiple sites of a network, instead of just once.
    1414The advantage however would be that different plugins on different sites would not run into issues with their metaboxes state changes influencing each other, as outlined in the ticket description.
    1515