WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#22730 closed defect (bug) (fixed)

Move utils.js to wp-includes and make it available for frontend media

Reported by: nacin Owned by:
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:

Description

We have user settings for a lot of media items, to remember what the user last did. On a site running something like P2, this is important as the user never really hits the admin. The settings are reset to Medium and Attachment Page every time, and the new setting for whether the user was on Upload or Media Library next is totally thrown off.

In 3.4, we loaded media-upload.php, which allowed utils.js to load and thus we had setUserSetting.

In 3.5, we don't. We should move utils.js to wp-includes/js/wp-cookies.js (or just utils.js) and make it a dependency of media.

It won't save to the DB until an admin hit, but it'll still set and use the cookie.

Attachments (2)

22730.diff (1.3 KB) - added by nacin 2 years ago.
With this, also move wp-admin/js/utils.js to wp-includes/js/utils.js
22730.2.diff (2.5 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (5)

@nacin2 years ago

With this, also move wp-admin/js/utils.js to wp-includes/js/utils.js

comment:1 @scribu2 years ago

Applied the patch, but it doesn't seem to help. The media tab is reset as soon as I refresh the page.

@nacin2 years ago

comment:2 @nacin2 years ago

In 23036:

Move utils.js (cookie and user setting functions) to wp-includes to enable front-end use.

Make it a dependency of media-views (and therefore media-editor). Move its userSettings JS object from admin-header to being paired with the script in script loader.

see #22730.

comment:3 @nacin2 years ago

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

Some random issues with attachment display settings didn't have to do with the user settings cookies, but rather [23037].

Note: See TracTickets for help on using tickets.