User Profile Picture - Version 1.0.18

Version Description

  • Added basic multisite support
Download this release

Release Info

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

Code changes from version 1.0.16 to 1.0.18

Files changed (3) hide show
  1. js/mpp.js +0 -1
  2. metronet-profile-picture.php +8 -11
  3. readme.txt +11 -1
js/mpp.js CHANGED
@@ -13,7 +13,6 @@ jQuery( document ).ready( function( $ ) {
13
  },
14
  'json'
15
  );
16
- //alert( 'yo' );
17
  };
18
 
19
  $('#metronet-upload-link a, #metronet-profile-image a.add_media').on( "click", function(e) {
13
  },
14
  'json'
15
  );
 
16
  };
17
 
18
  $('#metronet-upload-link a, #metronet-profile-image a.add_media').on( "click", function(e) {
metronet-profile-picture.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: 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: Metronet
7
- Version: 1.0.16
8
  Requires at least: 3.5
9
  Author URI: http://www.metronet.no
10
  Contributors: ronalfy, metronet
@@ -13,12 +13,9 @@ Contributors: ronalfy, metronet
13
  class Metronet_Profile_Picture {
14
 
15
  //private
16
- private $admin_options = array();
17
- private $errors = '';
18
  private $plugin_url = '';
19
  private $plugin_dir = '';
20
  private $plugin_path = '';
21
- private $plugin_slug = 'metronet_profile_picture';
22
 
23
  /**
24
  * __construct()
@@ -69,7 +66,7 @@ class Metronet_Profile_Picture {
69
  check_ajax_referer( "update-post_$post_id" );
70
 
71
  //Save user meta
72
- update_user_meta( $user_id, 'metronet_post_id', $post_id );
73
  set_post_thumbnail( $post_id, $thumbnail_id );
74
 
75
  if ( has_post_thumbnail( $post_id ) ) {
@@ -135,7 +132,7 @@ class Metronet_Profile_Picture {
135
  $user_id = $user->ID;
136
 
137
  //Determine if user has an avatar override
138
- $avatar_override = get_user_meta( $user_id, 'metronet_avatar_override', true );
139
  if ( !$avatar_override || $avatar_override != 'on' ) return $avatar;
140
 
141
  //Determine if the user has a profile image
@@ -319,7 +316,7 @@ class Metronet_Profile_Picture {
319
  <div id="metronet-upload-link"> - <?php echo $upload_link; ?> - <span class="description"><?php esc_html_e( 'Select "Set profile image" after uploading to choose the profile image', 'metronet_profile_picture' ); ?></span></div><!-- #metronet-upload-link -->
320
  <div id="metronet-override-avatar">
321
  <input type="hidden" name="metronet-user-avatar" value="off" /> -
322
- <input type="checkbox" name="metronet-user-avatar" id="metronet-user-avatar" value="on" <?php checked( "on", get_user_meta( $user_id, 'metronet_avatar_override', true ) ); ?> /><label for="metronet-user-avatar"> <?php esc_html_e( "Override Avatar?", "metronet_profile_picture" ); ?></label>
323
  </div><!-- #metronet-override-avatar -->
324
  <div id="metronet-pte">
325
  <?php echo $this->get_post_thumbnail_editor_link( $post_id ); ?>
@@ -343,7 +340,7 @@ class Metronet_Profile_Picture {
343
  //Post Thumbnail Editor compatibility - http://wordpress.org/extend/plugins/post-thumbnail-editor/
344
  $script_deps[] = 'thickbox';
345
  }
346
- wp_enqueue_script( 'mt-pp', $this->get_plugin_url( '/js/mpp.js' ), $script_deps, '1.0.16', true );
347
  wp_localize_script( 'mt-pp', 'metronet_profile_image',
348
  array(
349
  'set_profile_text' => __( 'Set profile image', 'metronet_profile_picture' ),
@@ -371,9 +368,9 @@ class Metronet_Profile_Picture {
371
 
372
  $user_avatar = $_POST[ 'metronet-user-avatar' ];
373
  if ( $user_avatar == 'on' ) {
374
- update_user_meta( $user_id, 'metronet_avatar_override', 'on' );
375
  } else {
376
- delete_user_meta( $user_id, 'metronet_avatar_override' );
377
  }
378
  } //end save_user_profile
379
 
@@ -401,7 +398,7 @@ function mt_mpp_instantiate() {
401
  echo - bool (true or false) - whether to echo the image or return it
402
  */
403
  function mt_profile_img( $user_id, $args = array() ) {
404
- $profile_post_id = absint( get_user_meta( $user_id, 'metronet_post_id', true ) );
405
 
406
  $defaults = array(
407
  'size' => 'thumbnail',
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: Metronet
7
+ Version: 1.0.18
8
  Requires at least: 3.5
9
  Author URI: http://www.metronet.no
10
  Contributors: ronalfy, metronet
13
  class Metronet_Profile_Picture {
14
 
15
  //private
 
 
16
  private $plugin_url = '';
17
  private $plugin_dir = '';
18
  private $plugin_path = '';
 
19
 
20
  /**
21
  * __construct()
66
  check_ajax_referer( "update-post_$post_id" );
67
 
68
  //Save user meta
69
+ update_user_option( $user_id, 'metronet_post_id', $post_id );
70
  set_post_thumbnail( $post_id, $thumbnail_id );
71
 
72
  if ( has_post_thumbnail( $post_id ) ) {
132
  $user_id = $user->ID;
133
 
134
  //Determine if user has an avatar override
135
+ $avatar_override = get_user_option( 'metronet_avatar_override', $user_id );
136
  if ( !$avatar_override || $avatar_override != 'on' ) return $avatar;
137
 
138
  //Determine if the user has a profile image
316
  <div id="metronet-upload-link"> - <?php echo $upload_link; ?> - <span class="description"><?php esc_html_e( 'Select "Set profile image" after uploading to choose the profile image', 'metronet_profile_picture' ); ?></span></div><!-- #metronet-upload-link -->
317
  <div id="metronet-override-avatar">
318
  <input type="hidden" name="metronet-user-avatar" value="off" /> -
319
+ <input type="checkbox" name="metronet-user-avatar" id="metronet-user-avatar" value="on" <?php checked( "on", get_user_option( 'metronet_avatar_override', $user_id ) ); ?> /><label for="metronet-user-avatar"> <?php esc_html_e( "Override Avatar?", "metronet_profile_picture" ); ?></label>
320
  </div><!-- #metronet-override-avatar -->
321
  <div id="metronet-pte">
322
  <?php echo $this->get_post_thumbnail_editor_link( $post_id ); ?>
340
  //Post Thumbnail Editor compatibility - http://wordpress.org/extend/plugins/post-thumbnail-editor/
341
  $script_deps[] = 'thickbox';
342
  }
343
+ wp_enqueue_script( 'mt-pp', $this->get_plugin_url( '/js/mpp.js' ), $script_deps, '1.0.17', true );
344
  wp_localize_script( 'mt-pp', 'metronet_profile_image',
345
  array(
346
  'set_profile_text' => __( 'Set profile image', 'metronet_profile_picture' ),
368
 
369
  $user_avatar = $_POST[ 'metronet-user-avatar' ];
370
  if ( $user_avatar == 'on' ) {
371
+ update_user_option( $user_id, 'metronet_avatar_override', 'on' );
372
  } else {
373
+ update_user_option( $user_id, 'metronet_avatar_override', 'off' );
374
  }
375
  } //end save_user_profile
376
 
398
  echo - bool (true or false) - whether to echo the image or return it
399
  */
400
  function mt_profile_img( $user_id, $args = array() ) {
401
+ $profile_post_id = absint( get_user_option( 'metronet_post_id', $user_id ) );
402
 
403
  $defaults = array(
404
  'size' => 'thumbnail',
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: metronet, ronalfy
3
  Tags: users, user, user profile
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
- Stable tag: 1.0.16
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -82,6 +82,10 @@ Since the plugin uses the native uploader, you'll have to make use of <a href='h
82
 
83
  We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbnail-editor/'>Post Thumbnail Editor</a> plugin for cropping thumbnails, as you can custom-crop various image sizes without affecting other images.
84
 
 
 
 
 
85
  == Screenshots ==
86
 
87
  1. Profile page options.
@@ -89,6 +93,9 @@ We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbn
89
  3. Post Thumbnail Editor compatibility.
90
 
91
  == Changelog ==
 
 
 
92
  = 1.0.16 =
93
  * Fixed a bug where only the profile image interface was showing for only authors and not editors and administrators.
94
 
@@ -119,6 +126,9 @@ We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbn
119
  * Initial release.
120
 
121
  == Upgrade Notice ==
 
 
 
122
  = 1.0.16 =
123
  Fixed a bug where only the profile image interface was showing for only authors and not editors and administrators.
124
 
3
  Tags: users, user, user profile
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
+ Stable tag: 1.0.18
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
82
 
83
  We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbnail-editor/'>Post Thumbnail Editor</a> plugin for cropping thumbnails, as you can custom-crop various image sizes without affecting other images.
84
 
85
+ = Does the plugin work with Multisite? =
86
+
87
+ Yes, but you'll have to set a new profile image per site. This is currently a limitation of the way the plugin stores its data. Ideas to overcome this are welcome.
88
+
89
  == Screenshots ==
90
 
91
  1. Profile page options.
93
  3. Post Thumbnail Editor compatibility.
94
 
95
  == Changelog ==
96
+ = 1.0.18 =
97
+ * Added basic multisite support
98
+
99
  = 1.0.16 =
100
  * Fixed a bug where only the profile image interface was showing for only authors and not editors and administrators.
101
 
126
  * Initial release.
127
 
128
  == Upgrade Notice ==
129
+ = 1.0.18 =
130
+ Added basic multisite support
131
+
132
  = 1.0.16 =
133
  Fixed a bug where only the profile image interface was showing for only authors and not editors and administrators.
134