Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#28659 closed defect (bug) (worksforme)

Save attachment order, AJAX-nonce missing

Reported by: ipm's profile IPM Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Media Keywords: reporter-feedback
Focuses: javascript Cc:

Description

There seems to be something wrong in media-models.js. When the action save-attachment-order is run no nonce is available for the AJAX call and thus the PHP function returns an error and the attachment order is not saved.

return media.post( 'save-attachment-order', {
    nonce:       media.model.settings.post.nonce

Here, media.model.settings.post.nonce does not exist. The action save-attachment works and uses the this.get('nonces').update value so I'm guessing the model is not properly updated which means this value is not available to the save-attachment-order action.

This has worked before so I'm guessing a bug was introduced in recent versions.

Change History (4)

#1 @wonderboymusic
11 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.0

We should take a look

#2 @wonderboymusic
11 years ago

  • Keywords reporter-feedback close added; needs-patch removed

This works for me.... existing post and when creating one with Add New...

Here are the steps I am taking:

  • click Add Media button
  • sort by Uploaded To This Post
  • add images and re-order, or re-order existing images
  • inspect the Network tab for the AJAX request and verify that the nonce value is populated

Let me know if my scenario is wrong.

#3 @IPM
11 years ago

Hi!

You are correct, that's the procedure. You are also correct in that it sometimes seem to work. I tried this on my own personal site instead of a couple of clients' and it did indeed work flawlessly. It might be plugin related then. I'm away on vacation now for a couple of days but will look further into the affected sites and see if I can repeat the issue with plugins disabled. If so, I may be able to provide you with a test environment.

Kind regards,
Michael

#4 @SergeyBiryukov
11 years ago

  • Keywords close removed
  • Milestone 4.0 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Could not reproduce either. Feel free to reopen with more information.

Note: See TracTickets for help on using tickets.