User Profile Picture - Version 1.4.1

Version Description

  • Released 2016-08-30 (Props @Monter)
  • Fix select states in image modal
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 User Profile Picture
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.4.0 to 1.4.1

Files changed (3) hide show
  1. js/mpp.js +15 -8
  2. metronet-profile-picture.php +2 -2
  3. readme.txt +8 -26
js/mpp.js CHANGED
@@ -40,11 +40,13 @@ jQuery( document ).ready( function( $ ) {
40
  //Assign the default view for the media uploader
41
 
42
  var uploader = wp.media({
 
 
43
  title: metronet_profile_image.set_profile_text,
44
  button: {
45
  text: metronet_profile_image.remove_profile_text
46
  },
47
- multiple: false // Set to true to allow multiple files to be selected
48
  });
49
 
50
  // CUSTOM TOOLBAR ON BOTTOM OF MEDIA MANAGER. SETS UP THE TWO ACTION BUTTONS
@@ -58,9 +60,10 @@ jQuery( document ).ready( function( $ ) {
58
  click: wp.media.view.Toolbar.Select.prototype.clickSelect,
59
  requires: { selection: true },
60
  event: 'select',
61
- reset: true,
62
  close: true,
63
- state: false
 
64
  };
65
  if ( ! $( '#metronet-profile-image a' ).hasClass('default-image') ) {
66
  options.items.remove = {
@@ -71,7 +74,8 @@ jQuery( document ).ready( function( $ ) {
71
  event: 'remove',
72
  reset: true,
73
  close: true,
74
- state: false
 
75
  };
76
  }
77
  this.createSelectToolbar( toolbar, options );
@@ -97,18 +101,20 @@ jQuery( document ).ready( function( $ ) {
97
  //For when the Add Profile Image is clicked
98
  uploader.on( 'select', function() {
99
 
100
- var featured_id = uploader.state().get('selection').first().id;
101
-
102
- if ( ! featured_id ) {
103
  return;
104
  }
105
 
106
- uploader.mt_featured_set( featured_id );
 
107
 
108
  } );
109
 
110
  //When the remove buttons is clicked
111
  uploader.on( 'remove', function() {
 
112
  mt_remove_profile_image();
113
  } );
114
 
@@ -124,6 +130,7 @@ jQuery( document ).ready( function( $ ) {
124
  });
125
  $( "#mpp" ).on( 'click', 'a#metronet-remove', function( e ) {
126
  e.preventDefault();
 
127
  mt_remove_profile_image();
128
  } );
129
 
40
  //Assign the default view for the media uploader
41
 
42
  var uploader = wp.media({
43
+ state: 'featured-image',
44
+ states: [ new wp.media.controller.FeaturedImage() ],
45
  title: metronet_profile_image.set_profile_text,
46
  button: {
47
  text: metronet_profile_image.remove_profile_text
48
  },
49
+ multiple: false,
50
  });
51
 
52
  // CUSTOM TOOLBAR ON BOTTOM OF MEDIA MANAGER. SETS UP THE TWO ACTION BUTTONS
60
  click: wp.media.view.Toolbar.Select.prototype.clickSelect,
61
  requires: { selection: true },
62
  event: 'select',
63
+ reset: false,
64
  close: true,
65
+ state: false,
66
+ syncSelection: true
67
  };
68
  if ( ! $( '#metronet-profile-image a' ).hasClass('default-image') ) {
69
  options.items.remove = {
74
  event: 'remove',
75
  reset: true,
76
  close: true,
77
+ state: false,
78
+ syncSelection: true
79
  };
80
  }
81
  this.createSelectToolbar( toolbar, options );
101
  //For when the Add Profile Image is clicked
102
  uploader.on( 'select', function() {
103
 
104
+ var featured = uploader.state().get('selection').single();
105
+ wp.media.featuredImage.set( featured ? featured.id : -1 );
106
+ if ( ! featured.id ) {
107
  return;
108
  }
109
 
110
+ uploader.mt_featured_set( featured.id );
111
+
112
 
113
  } );
114
 
115
  //When the remove buttons is clicked
116
  uploader.on( 'remove', function() {
117
+ wp.media.featuredImage.set( -1 );
118
  mt_remove_profile_image();
119
  } );
120
 
130
  });
131
  $( "#mpp" ).on( 'click', 'a#metronet-remove', function( e ) {
132
  e.preventDefault();
133
+ wp.media.featuredImage.set( -1 );
134
  mt_remove_profile_image();
135
  } );
136
 
metronet-profile-picture.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: User Profile Picture
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
- Version: 1.4.0
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
@@ -431,7 +431,7 @@ class Metronet_Profile_Picture {
431
  $post_id = $this->get_post_id( $this->get_user_id() );
432
  wp_enqueue_media( array( 'post' => $post_id ) );
433
  $script_deps = array( 'media-editor' );
434
- wp_enqueue_script( 'mt-pp', $this->get_plugin_url( '/js/mpp.js' ), $script_deps, '20160829', true );
435
  wp_localize_script( 'mt-pp', 'metronet_profile_image',
436
  array(
437
  'set_profile_text' => __( 'Set Profile Image', 'metronet-profile-picture' ),
4
  Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
5
  Description: Use the native WP uploader on your user profile page.
6
  Author: Ronald Huereca
7
+ Version: 1.4.1
8
  Requires at least: 3.5
9
  Author URI: https://www.mediaron.com
10
  Contributors: ronalfy
431
  $post_id = $this->get_post_id( $this->get_user_id() );
432
  wp_enqueue_media( array( 'post' => $post_id ) );
433
  $script_deps = array( 'media-editor' );
434
+ wp_enqueue_script( 'mt-pp', $this->get_plugin_url( '/js/mpp.js' ), $script_deps, '20160830', true );
435
  wp_localize_script( 'mt-pp', 'metronet_profile_image',
436
  array(
437
  'set_profile_text' => __( 'Set Profile Image', 'metronet-profile-picture' ),
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: ronalfy
3
  Tags: users, user, user profile
4
  Requires at least: 3.5
5
  Tested up to: 4.6
6
- Stable tag: 1.4.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://mediaron.com/contribute/
@@ -114,6 +114,10 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
114
 
115
  == Changelog ==
116
 
 
 
 
 
117
  = 1.4.0 =
118
  * Released 2016-08-29 (props kelderic)
119
  * Bug fix: CSS Fixes to the trashcan icon and image placeholders
@@ -219,30 +223,8 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
219
 
220
  == Upgrade Notice ==
221
 
 
 
 
222
  = 1.4.0 =
223
  Avatar override is now a default option. Numerous bug fixes. Please see changelog.
224
-
225
- = 1.3.1 =
226
- Fixing thumbnail calls that could potential be inadvertently filtered and cause the profile picture to provide an erroneous callback.
227
-
228
- = 1.3.0 =
229
- Adding REST API endpoint.
230
-
231
- = 1.2.7 =
232
- Bug fix for warning message saying missing argument for avatar_override.
233
-
234
- = 1.2.5 =
235
- Bug fix for avatar override to accept custom CSS classes.
236
-
237
- = 1.2.3 =
238
- Made MPP post type completely hidden. mt_profile_img refactored to avoid filtered output.
239
-
240
- = 1.2.2 =
241
- Added compatibility to Advanced Custom Fields. Ensuring WordPress 4.2 compatibility.
242
-
243
- = 1.2.1 =
244
- Fixed internationalization errors. Added Spanish translation.
245
-
246
- = 1.2.0 =
247
- Reducing clutter in the interface. Removed text option to upload. Added default image if no profile image is available. Added option to remove the profile image.
248
-
3
  Tags: users, user, user profile
4
  Requires at least: 3.5
5
  Tested up to: 4.6
6
+ Stable tag: 1.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://mediaron.com/contribute/
114
 
115
  == Changelog ==
116
 
117
+ = 1.4.1 =
118
+ * Released 2016-08-30 (Props @Monter)
119
+ * Fix select states in image modal
120
+
121
  = 1.4.0 =
122
  * Released 2016-08-29 (props kelderic)
123
  * Bug fix: CSS Fixes to the trashcan icon and image placeholders
223
 
224
  == Upgrade Notice ==
225
 
226
+ = 1.4.1 =
227
+ Fix select states in image modal.
228
+
229
  = 1.4.0 =
230
  Avatar override is now a default option. Numerous bug fixes. Please see changelog.