Taxonomy Images - Version 0.9.3

Version Description

Fix post permissions error when using media modal.

Download this release

Release Info

Developer husobj
Plugin Icon 128x128 Taxonomy Images
Version 0.9.3
Comparing to
See all releases

Code changes from version 0.9.2 to 0.9.3

Files changed (5) hide show
  1. CHANGELOG.md +8 -1
  2. README.md +3 -0
  3. js/media-modal.js +7 -11
  4. readme.txt +8 -2
  5. taxonomy-images.php +2 -2
CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
 
5
  ## [Unreleased]
6
 
 
 
 
 
 
7
  ## [0.9.2] - 2015-12-15
8
 
9
  ### Added
@@ -188,7 +193,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
188
  ### Added
189
  - Original Release - Works with WordPress 2.9.1.
190
 
191
- [Unreleased]: https://github.com/benhuson/Taxonomy-Images/compare/0.9.1...HEAD
 
 
192
  [0.9.1]: https://github.com/benhuson/Taxonomy-Images/compare/0.9...0.9.1
193
  [0.9]: https://github.com/benhuson/Taxonomy-Images/compare/0.8.0...0.9
194
  [0.8.0]: https://github.com/benhuson/Taxonomy-Images/compare/0.7.3...0.8.0
4
 
5
  ## [Unreleased]
6
 
7
+ ## [0.9.3] - 2016-01-21
8
+
9
+ ### Fixed
10
+ - Fix post permissions error when using media modal.
11
+
12
  ## [0.9.2] - 2015-12-15
13
 
14
  ### Added
193
  ### Added
194
  - Original Release - Works with WordPress 2.9.1.
195
 
196
+ [Unreleased]: https://github.com/benhuson/Taxonomy-Images/compare/0.9.3...HEAD
197
+ [0.9.3]: https://github.com/benhuson/Taxonomy-Images/compare/0.9.2...0.9.3
198
+ [0.9.2]: https://github.com/benhuson/Taxonomy-Images/compare/0.9.1...0.9.2
199
  [0.9.1]: https://github.com/benhuson/Taxonomy-Images/compare/0.9...0.9.1
200
  [0.9]: https://github.com/benhuson/Taxonomy-Images/compare/0.8.0...0.9
201
  [0.8.0]: https://github.com/benhuson/Taxonomy-Images/compare/0.7.3...0.8.0
README.md CHANGED
@@ -221,6 +221,9 @@ Installation
221
  Upgrade Notice
222
  --------------
223
 
 
 
 
224
  ### 0.9.2
225
  Fix old and new media modal opening simultaneously in some circumstances.
226
 
221
  Upgrade Notice
222
  --------------
223
 
224
+ ### 0.9.3
225
+ Fix post permissions error when using media modal.
226
+
227
  ### 0.9.2
228
  Fix old and new media modal opening simultaneously in some circumstances.
229
 
js/media-modal.js CHANGED
@@ -7,7 +7,7 @@ var taxonomy_images_file_frame;
7
  $( document ).ready( function() {
8
 
9
  // Store the old id (not sure if this is application when editing a term)
10
- TaxonomyImagesMediaModal.wp_media_post_id = wp.media.model.settings.post.id;
11
 
12
  // When the remove icon is clicked...
13
  $( '.wp-list-table, .form-table' ).on( 'click', '.taxonomy-image-control a.remove', function( event ) {
@@ -56,6 +56,7 @@ var taxonomy_images_file_frame;
56
 
57
  button = $( this );
58
 
 
59
  TaxonomyImagesMediaModal.attachment_id = $( this ).data( 'attachment-id' );
60
  TaxonomyImagesMediaModal.nonce = $( this ).data( 'nonce' );
61
 
@@ -63,24 +64,21 @@ var taxonomy_images_file_frame;
63
  if ( taxonomy_images_file_frame ) {
64
 
65
  // Set the post ID to the term being edited and open
66
- wp.media.model.settings.post.id = $( this ).data( 'tt-id' );
67
- taxonomy_images_file_frame.uploader.uploader.param( 'post_id', $( this ).data( 'tt-id' ) );
68
  taxonomy_images_file_frame.open();
69
  return;
70
 
71
  } else {
72
 
73
  // Set the wp.media post id so the uploader grabs the term ID being edited
74
- wp.media.model.settings.post.id = $( this ).data( 'tt-id' );
75
 
76
  }
77
 
78
  // Create the media frame.
79
  taxonomy_images_file_frame = wp.media.frames.taxonomy_images_file_frame = wp.media( {
80
  title : TaxonomyImagesMediaModal.uploader_title,
81
- button : {
82
- text : TaxonomyImagesMediaModal.uploader_button_text,
83
- },
84
  multiple : false
85
  } );
86
 
@@ -101,7 +99,7 @@ var taxonomy_images_file_frame;
101
  // We set multiple to false so only get one image from the uploader
102
  attachment = taxonomy_images_file_frame.state().get( 'selection' ).first().toJSON();
103
 
104
- var tt_id = wp.media.model.settings.post.id;
105
  var attachment_id = attachment.id;
106
 
107
  // Do something with attachment.id and/or attachment.url here
@@ -113,7 +111,7 @@ var taxonomy_images_file_frame;
113
  'action' : 'taxonomy_image_create_association',
114
  'wp_nonce' : TaxonomyImagesMediaModal.nonce,
115
  'attachment_id' : attachment.id,
116
- 'tt_id' : parseInt( wp.media.model.settings.post.id )
117
  },
118
  success : function ( response ) {
119
  if ( 'good' === response.status ) {
@@ -148,8 +146,6 @@ var taxonomy_images_file_frame;
148
  }
149
  } );
150
 
151
- wp.media.model.settings.post.id = TaxonomyImagesMediaModal.wp_media_post_id;
152
-
153
  } );
154
 
155
  // Finally, open the modal
7
  $( document ).ready( function() {
8
 
9
  // Store the old id (not sure if this is application when editing a term)
10
+ TaxonomyImagesMediaModal.ttID = 0;
11
 
12
  // When the remove icon is clicked...
13
  $( '.wp-list-table, .form-table' ).on( 'click', '.taxonomy-image-control a.remove', function( event ) {
56
 
57
  button = $( this );
58
 
59
+ TaxonomyImagesMediaModal.ttID = $( this ).data( 'tt-id' );
60
  TaxonomyImagesMediaModal.attachment_id = $( this ).data( 'attachment-id' );
61
  TaxonomyImagesMediaModal.nonce = $( this ).data( 'nonce' );
62
 
64
  if ( taxonomy_images_file_frame ) {
65
 
66
  // Set the post ID to the term being edited and open
 
 
67
  taxonomy_images_file_frame.open();
68
  return;
69
 
70
  } else {
71
 
72
  // Set the wp.media post id so the uploader grabs the term ID being edited
73
+ TaxonomyImagesMediaModal.ttID = $( this ).data( 'tt-id' );
74
 
75
  }
76
 
77
  // Create the media frame.
78
  taxonomy_images_file_frame = wp.media.frames.taxonomy_images_file_frame = wp.media( {
79
  title : TaxonomyImagesMediaModal.uploader_title,
80
+ button : { text : TaxonomyImagesMediaModal.uploader_button_text },
81
+ library : { type: 'image' },
 
82
  multiple : false
83
  } );
84
 
99
  // We set multiple to false so only get one image from the uploader
100
  attachment = taxonomy_images_file_frame.state().get( 'selection' ).first().toJSON();
101
 
102
+ var tt_id = TaxonomyImagesMediaModal.ttID;
103
  var attachment_id = attachment.id;
104
 
105
  // Do something with attachment.id and/or attachment.url here
111
  'action' : 'taxonomy_image_create_association',
112
  'wp_nonce' : TaxonomyImagesMediaModal.nonce,
113
  'attachment_id' : attachment.id,
114
+ 'tt_id' : parseInt( TaxonomyImagesMediaModal.ttID )
115
  },
116
  success : function ( response ) {
117
  if ( 'good' === response.status ) {
146
  }
147
  } );
148
 
 
 
149
  } );
150
 
151
  // Finally, open the modal
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mfields, husobj, jamiemchale
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QSYTTQZBRKQVE
4
  Tags: taxonomy, tag, category, term, image, upload, media
5
  Requires at least: 3.4
6
- Tested up to: 4.4
7
- Stable tag: 0.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -209,6 +209,9 @@ The original author of this plugin, Michael Fields, released a handful of plugin
209
 
210
  == Upgrade Notice ==
211
 
 
 
 
212
  = 0.9.2 =
213
  Fix old and new media modal opening simultaneously in some circumstances.
214
 
@@ -226,6 +229,9 @@ Complete rewrite. Better everything. Many bug fixes.
226
 
227
  == Changelog ==
228
 
 
 
 
229
  = 0.9.2 =
230
  * __BUGFIX:__ Fix old and new media modal opening simultaneously in some circumstances.
231
  * __UPDATE:__ Documentation: Pedantic corrections. Props [Gary Jones](https://profiles.wordpress.org/garyj)
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QSYTTQZBRKQVE
4
  Tags: taxonomy, tag, category, term, image, upload, media
5
  Requires at least: 3.4
6
+ Tested up to: 4.4.1
7
+ Stable tag: 0.9.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
209
 
210
  == Upgrade Notice ==
211
 
212
+ = 0.9.3 =
213
+ Fix post permissions error when using media modal.
214
+
215
  = 0.9.2 =
216
  Fix old and new media modal opening simultaneously in some circumstances.
217
 
229
 
230
  == Changelog ==
231
 
232
+ = 0.9.3 =
233
+ * __BUGFIX:__ Fix post permissions error when using media modal.
234
+
235
  = 0.9.2 =
236
  * __BUGFIX:__ Fix old and new media modal opening simultaneously in some circumstances.
237
  * __UPDATE:__ Documentation: Pedantic corrections. Props [Gary Jones](https://profiles.wordpress.org/garyj)
taxonomy-images.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Taxonomy Images
5
  Plugin URI: https://github.com/benhuson/Taxonomy-Images
6
  Description: Associate images from your media library to categories, tags and custom taxonomies.
7
- Version: 0.9.2
8
  Author: Michael Fields, Ben Huson
9
  Author URI: https://github.com/benhuson
10
  License: GNU General Public License v2 or later
@@ -40,7 +40,7 @@ require_once( trailingslashit( dirname( __FILE__ ) ) . 'public-filters.php' );
40
  * @alter 0.7.4
41
  */
42
  function taxonomy_image_plugin_version() {
43
- return '0.9.2';
44
  }
45
 
46
 
4
  Plugin Name: Taxonomy Images
5
  Plugin URI: https://github.com/benhuson/Taxonomy-Images
6
  Description: Associate images from your media library to categories, tags and custom taxonomies.
7
+ Version: 0.9.3
8
  Author: Michael Fields, Ben Huson
9
  Author URI: https://github.com/benhuson
10
  License: GNU General Public License v2 or later
40
  * @alter 0.7.4
41
  */
42
  function taxonomy_image_plugin_version() {
43
+ return '0.9.3';
44
  }
45
 
46