WP User Avatar - Version 1.5.7

Version Description

  • Bug Fix: Separate out JavaScript for Subscribers
  • Bug Fix: Subscriber uploader not finding error type
Download this release

Release Info

Developer bangbay
Plugin Icon 128x128 WP User Avatar
Version 1.5.7
Comparing to
See all releases

Code changes from version 1.5.4 to 1.5.7

includes/tinymce.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
- * @version 1.5.4
5
  */
6
 
7
  if(!defined('ABSPATH')){
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
+ * @version 1.5.7
5
  */
6
 
7
  if(!defined('ABSPATH')){
includes/tinymce/editor_plugin.js CHANGED
@@ -1 +1 @@
1
- (function(){tinymce.PluginManager.requireLangPack('wpUserAvatar');tinymce.create('tinymce.plugins.wpUserAvatar',{init:function(ed,url){ed.addCommand('mceWpUserAvatar',function(){ed.windowManager.open({file:ajaxurl+'?action=wp_user_avatar_tinymce',width:500,height:265,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wp-user-avatar-32x32.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('wpUserAvatar',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'WP User Avatar',author:'Bangbay Siboliban',authorurl:'http://siboliban.org/',infourl:'http://wordpress.org/extend/plugins/wp-user-avatar/',version:"1.5.4"}}});tinymce.PluginManager.add('wpUserAvatar',tinymce.plugins.wpUserAvatar)})();
1
+ (function(){tinymce.PluginManager.requireLangPack('wpUserAvatar');tinymce.create('tinymce.plugins.wpUserAvatar',{init:function(ed,url){ed.addCommand('mceWpUserAvatar',function(){ed.windowManager.open({file:ajaxurl+'?action=wp_user_avatar_tinymce',width:500,height:265,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wp-user-avatar-32x32.png'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('wpUserAvatar',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'WP User Avatar',author:'Bangbay Siboliban',authorurl:'http://siboliban.org/',infourl:'http://wordpress.org/extend/plugins/wp-user-avatar/',version:"1.5.7"}}});tinymce.PluginManager.add('wpUserAvatar',tinymce.plugins.wpUserAvatar)})();
includes/tinymce/window.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
- * @version 1.5.4
5
  */
6
 
7
  if(!defined('ABSPATH')){
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
+ * @version 1.5.7
5
  */
6
 
7
  if(!defined('ABSPATH')){
js/wp-user-avatar-user.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Remove WP User Avatar
2
+ function wpuaRemoveAvatar(avatar_thumb){
3
+ jQuery('body').on('click', '#wpua-remove', function(e){
4
+ e.preventDefault();
5
+ jQuery(this).hide();
6
+ jQuery('#wpua-edit, #wpua-thumbnail').hide();
7
+ jQuery('#wpua-preview').find('img').attr('src', avatar_thumb).removeAttr('width', "").removeAttr('height', "");
8
+ jQuery('#wp-user-avatar').val("");
9
+ jQuery('#wpua-message').show();
10
+ jQuery('#wp_user_avatar_radio').trigger('click');
11
+ });
12
+ }
13
+
14
+ jQuery(function(){
15
+ // Add enctype to form with JavaScript as backup
16
+ jQuery('#your-profile').attr('enctype', 'multipart/form-data');
17
+ // Remove settings
18
+ wpuaRemoveAvatar(wpua_custom.avatar_thumb);
19
+ });
js/wp-user-avatar.js CHANGED
@@ -1 +1 @@
1
- function wpuaMediaUploader(c,d,f){wp.media.wpUserAvatar={get:function(){return wp.media.view.settings.post.wpUserAvatarId},set:function(a){var b=wp.media.view.settings;b.post.wpUserAvatarId=a;b.post.wpUserAvatarSrc=jQuery('div.attachment-info').find('img').attr('src');if(b.post.wpUserAvatarId){wpuaSetAvatar(b.post.wpUserAvatarId,b.post.wpUserAvatarSrc);jQuery('#wp_user_avatar_radio').trigger('click')}},frame:function(){if(this._frame){return this._frame}this._frame=wp.media({state:'library',states:[new wp.media.controller.Library({title:d+": "+c})]});this._frame.on('open',function(){var a=this.state().get('selection');id=jQuery('#wp-user-avatar').val();attachment=wp.media.attachment(id);attachment.fetch();a.add(attachment?[attachment]:[])},this._frame);this._frame.on('toolbar:create:select',function(a){this.createSelectToolbar(a,{text:f})},this._frame);this._frame.state('library').on('select',this.select);return this._frame},select:function(a){var b=wp.media.view.settings,selection=this.get('selection').single();wp.media.wpUserAvatar.set(selection?selection.id:-1)},init:function(){jQuery('body').on('click','#wpua-add',function(e){e.preventDefault();e.stopPropagation();wp.media.wpUserAvatar.frame().open()})}};jQuery(wp.media.wpUserAvatar.init)}function wpuaSetAvatar(a,b){jQuery('#wp-user-avatar',window.parent.document).val(a);jQuery('#wpua-preview',window.parent.document).find('img').attr('src',b).removeAttr('width',"").removeAttr('height',"");jQuery('#wpua-message',window.parent.document).show();jQuery('#wpua-remove',window.parent.document).removeClass('wpua-hide').show();jQuery('#wpua-thumbnail',window.parent.document).hide();jQuery('#wp_user_avatar_radio',window.parent.document).trigger('click');wp.media.wpUserAvatar.frame().close()}function wpuaRemoveAvatar(a){jQuery('body').on('click','#wpua-remove',function(e){e.preventDefault();jQuery(this).hide();jQuery('#wpua-edit, #wpua-thumbnail').hide();jQuery('#wpua-preview').find('img').attr('src',a).removeAttr('width',"").removeAttr('height',"");jQuery('#wp-user-avatar').val("");jQuery('#wpua-message').show();jQuery('#wp_user_avatar_radio').trigger('click')})}jQuery(function(){jQuery('#your-profile').attr('enctype','multipart/form-data');if(typeof(wp)!='undefined'){wpuaMediaUploader(wpua_custom.section,wpua_custom.edit_image,wpua_custom.select_image)}wpuaRemoveAvatar(wpua_custom.avatar_thumb)});
1
+ function wpuaMediaUploader(section,edit_text,insert_text){wp.media.wpUserAvatar={get:function(){return wp.media.view.settings.post.wpUserAvatarId},set:function(id){var settings=wp.media.view.settings;settings.post.wpUserAvatarId=id;settings.post.wpUserAvatarSrc=jQuery('div.attachment-info').find('img').attr('src');if(settings.post.wpUserAvatarId){wpuaSetAvatar(settings.post.wpUserAvatarId,settings.post.wpUserAvatarSrc);jQuery('#wp_user_avatar_radio').trigger('click')}},frame:function(){if(this._frame){return this._frame}this._frame=wp.media({state:'library',states:[new wp.media.controller.Library({title:edit_text+": "+section})]});this._frame.on('open',function(){var selection=this.state().get('selection');id=jQuery('#wp-user-avatar').val();attachment=wp.media.attachment(id);attachment.fetch();selection.add(attachment?[attachment]:[])},this._frame);this._frame.on('toolbar:create:select',function(toolbar){this.createSelectToolbar(toolbar,{text:insert_text})},this._frame);this._frame.state('library').on('select',this.select);return this._frame},select:function(id){var settings=wp.media.view.settings,selection=this.get('selection').single();wp.media.wpUserAvatar.set(selection?selection.id:-1)},init:function(){jQuery('body').on('click','#wpua-add',function(e){e.preventDefault();e.stopPropagation();wp.media.wpUserAvatar.frame().open()})}};jQuery(wp.media.wpUserAvatar.init)}function wpuaSetAvatar(attachment,imageURL){jQuery('#wp-user-avatar',window.parent.document).val(attachment);jQuery('#wpua-preview',window.parent.document).find('img').attr('src',imageURL).removeAttr('width',"").removeAttr('height',"");jQuery('#wpua-message',window.parent.document).show();jQuery('#wpua-remove',window.parent.document).removeClass('wpua-hide').show();jQuery('#wpua-thumbnail',window.parent.document).hide();jQuery('#wp_user_avatar_radio',window.parent.document).trigger('click');wp.media.wpUserAvatar.frame().close()}function wpuaRemoveAvatar(avatar_thumb){jQuery('body').on('click','#wpua-remove',function(e){e.preventDefault();jQuery(this).hide();jQuery('#wpua-edit, #wpua-thumbnail').hide();jQuery('#wpua-preview').find('img').attr('src',avatar_thumb).removeAttr('width',"").removeAttr('height',"");jQuery('#wp-user-avatar').val("");jQuery('#wpua-message').show();jQuery('#wp_user_avatar_radio').trigger('click')})}jQuery(function(){jQuery('#your-profile').attr('enctype','multipart/form-data');if(typeof(wp)!='undefined'){wpuaMediaUploader(wpua_custom.section,wpua_custom.edit_image,wpua_custom.select_image)}wpuaRemoveAvatar(wpua_custom.avatar_thumb)});
lang/wp-user-avatar-de_DE.mo CHANGED
Binary file
lang/wp-user-avatar-de_DE.po CHANGED
@@ -4,9 +4,9 @@
4
  #
5
  msgid ""
6
  msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
  "Language: de_DE\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
  msgid "Click %s to save your changes"
20
  msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
21
 
22
- #: wp-user-avatar.php:870
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
25
 
26
- #: wp-user-avatar.php:875
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
29
 
30
- #: wp-user-avatar.php:880
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
33
 
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Dateigrößenbeschränkung (nur für Mitarbeiter und Abonnenten)"
38
 
39
- #: wp-user-avatar.php:902
40
  msgid "Allow users to edit avatars"
41
  msgstr "Benutzer erlauben, Avatare bearbeiten"
42
 
4
  #
5
  msgid ""
6
  msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.7\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
  "Language: de_DE\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:800
19
  msgid "Click %s to save your changes"
20
  msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
21
 
22
+ #: wp-user-avatar.php:872
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
25
 
26
+ #: wp-user-avatar.php:877
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
29
 
30
+ #: wp-user-avatar.php:882
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
33
 
34
+ #: wp-user-avatar.php:890
35
+ #: wp-user-avatar.php:895
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Dateigrößenbeschränkung (nur für Mitarbeiter und Abonnenten)"
38
 
39
+ #: wp-user-avatar.php:904
40
  msgid "Allow users to edit avatars"
41
  msgstr "Benutzer erlauben, Avatare bearbeiten"
42
 
lang/wp-user-avatar-es_ES.mo CHANGED
Binary file
lang/wp-user-avatar-es_ES.po CHANGED
@@ -4,9 +4,9 @@
4
  #
5
  msgid ""
6
  msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
  "Language: es_ES\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
  msgid "Click %s to save your changes"
20
  msgstr "Haz clic %s para guardar los cambios"
21
 
22
- #: wp-user-avatar.php:870
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Añadir botón avatar al editor visual"
25
 
26
- #: wp-user-avatar.php:875
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Permitir los colaboradores y los suscriptores subir avatares"
29
 
30
- #: wp-user-avatar.php:880
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Desactivar Gravatar y utilizar sólo los avatares locales"
33
 
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Sube límite de tamaño (para colaboradores y suscriptores)"
38
 
39
- #: wp-user-avatar.php:902
40
  msgid "Allow users to edit avatars"
41
  msgstr "Permitir a los usuarios editar avatar"
42
 
4
  #
5
  msgid ""
6
  msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.7\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
  "Language: es_ES\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:800
19
  msgid "Click %s to save your changes"
20
  msgstr "Haz clic %s para guardar los cambios"
21
 
22
+ #: wp-user-avatar.php:872
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Añadir botón avatar al editor visual"
25
 
26
+ #: wp-user-avatar.php:877
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Permitir los colaboradores y los suscriptores subir avatares"
29
 
30
+ #: wp-user-avatar.php:882
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Desactivar Gravatar y utilizar sólo los avatares locales"
33
 
34
+ #: wp-user-avatar.php:890
35
+ #: wp-user-avatar.php:895
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Sube límite de tamaño (para colaboradores y suscriptores)"
38
 
39
+ #: wp-user-avatar.php:904
40
  msgid "Allow users to edit avatars"
41
  msgstr "Permitir a los usuarios editar avatar"
42
 
lang/wp-user-avatar-fr_FR.mo CHANGED
Binary file
lang/wp-user-avatar-fr_FR.po CHANGED
@@ -4,9 +4,9 @@
4
  #
5
  msgid ""
6
  msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
  "Language: fr_FR\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
@@ -14,29 +14,29 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
  msgid "Click %s to save your changes"
20
  msgstr "Cliquez sur %s pour enregistrer vos modifications"
21
 
22
- #: wp-user-avatar.php:870
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
25
 
26
- #: wp-user-avatar.php:875
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Permettre aux contributeurs et aux abonnés d'envoyer des avatars"
29
 
30
- #: wp-user-avatar.php:880
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Désactiver Gravatar et utiliser les avatars fournis"
33
 
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Taille limite d'envoi de fichiers (pour contributeurs et abonnés)"
38
 
39
- #: wp-user-avatar.php:902
40
  msgid "Allow users to edit avatars"
41
  msgstr "Permettre aux utilisateurs de modifier avatar"
42
 
4
  #
5
  msgid ""
6
  msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.7\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
  "Language: fr_FR\n"
11
  "Last-Translator: WP User Avatar\n"
12
  "Language-Team: WP User Avatar\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:800
19
  msgid "Click %s to save your changes"
20
  msgstr "Cliquez sur %s pour enregistrer vos modifications"
21
 
22
+ #: wp-user-avatar.php:872
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
25
 
26
+ #: wp-user-avatar.php:877
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Permettre aux contributeurs et aux abonnés d'envoyer des avatars"
29
 
30
+ #: wp-user-avatar.php:882
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Désactiver Gravatar et utiliser les avatars fournis"
33
 
34
+ #: wp-user-avatar.php:890
35
+ #: wp-user-avatar.php:895
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Taille limite d'envoi de fichiers (pour contributeurs et abonnés)"
38
 
39
+ #: wp-user-avatar.php:904
40
  msgid "Allow users to edit avatars"
41
  msgstr "Permettre aux utilisateurs de modifier avatar"
42
 
lang/wp-user-avatar-sv_SE.mo CHANGED
Binary file
lang/wp-user-avatar-sv_SE.po CHANGED
@@ -4,9 +4,9 @@
4
  #
5
  msgid ""
6
  msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5.4\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
- "PO-Revision-Date: 2013-07-31 00:00-0000\n"
10
  "Language: sv_SE\n"
11
  "Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
12
  "Language-Team: WordPress Sverige <info@wpsv.se>\n"
@@ -14,29 +14,29 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
- #: wp-user-avatar.php:341
18
- #: wp-user-avatar.php:798
19
  msgid "Click %s to save your changes"
20
  msgstr "Klicka på %s för att spara dina ändringar"
21
 
22
- #: wp-user-avatar.php:870
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Lägg till knapp för avatarer i den visuella redigeraren"
25
 
26
- #: wp-user-avatar.php:875
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
29
 
30
- #: wp-user-avatar.php:880
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Inaktivera Gravatar och använd endast lokala avatarer"
33
 
34
- #: wp-user-avatar.php:888
35
- #: wp-user-avatar.php:893
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Storleksgräns för uppladdningar (endast för medarbetare & prenumeranter)"
38
 
39
- #: wp-user-avatar.php:902
40
  msgid "Allow users to edit avatars"
41
  msgstr "Tillåt användare att redigera avatarer"
42
 
4
  #
5
  msgid ""
6
  msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.7\n"
8
  "Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
+ "PO-Revision-Date: 2013-08-08 00:00-0000\n"
10
  "Language: sv_SE\n"
11
  "Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
12
  "Language-Team: WordPress Sverige <info@wpsv.se>\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
 
17
+ #: wp-user-avatar.php:340
18
+ #: wp-user-avatar.php:800
19
  msgid "Click %s to save your changes"
20
  msgstr "Klicka på %s för att spara dina ändringar"
21
 
22
+ #: wp-user-avatar.php:872
23
  msgid "Add avatar button to Visual Editor"
24
  msgstr "Lägg till knapp för avatarer i den visuella redigeraren"
25
 
26
+ #: wp-user-avatar.php:877
27
  msgid "Allow Contributors & Subscribers to upload avatars"
28
  msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
29
 
30
+ #: wp-user-avatar.php:882
31
  msgid "Disable Gravatar and use only local avatars"
32
  msgstr "Inaktivera Gravatar och använd endast lokala avatarer"
33
 
34
+ #: wp-user-avatar.php:890
35
+ #: wp-user-avatar.php:895
36
  msgid "Upload Size Limit (only for Contributors & Subscribers)"
37
  msgstr "Storleksgräns för uppladdningar (endast för medarbetare & prenumeranter)"
38
 
39
+ #: wp-user-avatar.php:904
40
  msgid "Allow users to edit avatars"
41
  msgstr "Tillåt användare att redigera avatarer"
42
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: bangbay
4
  Donate link: http://siboliban.org/donate
5
  Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo
6
  Requires at least: 3.5
7
- Tested up to: 3.7-alpha-24927
8
- Stable tag: 1.5.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -230,6 +230,17 @@ Outputs:
230
 
231
  == Changelog ==
232
 
 
 
 
 
 
 
 
 
 
 
 
233
  = 1.5.4 =
234
  * Add: Option to enable avatar editing privilege for Subscribers
235
  * Add: Swedish translation
4
  Donate link: http://siboliban.org/donate
5
  Tags: author image, author photo, author avatar, avatar, bbPress, profile avatar, profile image, user avatar, user image, user photo
6
  Requires at least: 3.5
7
+ Tested up to: 3.6
8
+ Stable tag: 1.5.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
230
 
231
  == Changelog ==
232
 
233
+ = 1.5.7 =
234
+ * Bug Fix: Separate out JavaScript for Subscribers
235
+ * Bug Fix: Subscriber uploader not finding error type
236
+
237
+ = 1.5.6 =
238
+ * Update: Use cache for wpua_has_gravatar
239
+
240
+ = 1.5.5 =
241
+ * Bug Fix: Hide "Edit Image" button if Contributors & Subscribers can't edit avatar
242
+ * Bug Fix: Remove edit_posts capability if Subscribers can't edit avatar
243
+
244
  = 1.5.4 =
245
  * Add: Option to enable avatar editing privilege for Subscribers
246
  * Add: Swedish translation
uninstall.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
- * @version 1.5.4
5
  */
6
 
7
  // Remove user metadata and options on plugin delete
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
+ * @version 1.5.7
5
  */
6
 
7
  // Remove user metadata and options on plugin delete
wp-user-avatar.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
- * @version 1.5.4
5
  */
6
  /*
7
  Plugin Name: WP User Avatar
@@ -9,7 +9,7 @@ Plugin URI: http://wordpress.org/plugins/wp-user-avatar/
9
  Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
10
  Author: Bangbay Siboliban
11
  Author URI: http://siboliban.org/
12
- Version: 1.5.4
13
  Text Domain: wp-user-avatar
14
  Domain Path: /lang/
15
  */
@@ -20,7 +20,7 @@ if(!defined('ABSPATH')){
20
  }
21
 
22
  // Define paths and variables
23
- define('WPUA_VERSION', ' 1.5.4');
24
  define('WPUA_FOLDER', basename(dirname(__FILE__)));
25
  define('WPUA_ABSPATH', trailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR.'/'.WPUA_FOLDER)));
26
  define('WPUA_URLPATH', trailingslashit(plugins_url(WPUA_FOLDER)));
@@ -38,7 +38,6 @@ $mustache_medium = WPUA_URLPATH.'images/wp-user-avatar-300x300.png';
38
  $mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
39
  $mustache_avatar = WPUA_URLPATH.'images/wp-user-avatar-96x96.png';
40
  $mustache_admin = WPUA_URLPATH.'images/wp-user-avatar-32x32.png';
41
- $ssl = is_ssl() ? 's' : "";
42
 
43
  // Check for updates
44
  $wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
@@ -388,12 +387,10 @@ if(!class_exists('wp_user_avatar')){
388
  }
389
  $name = $_FILES['wp-user-avatar-file']['name'];
390
  $file = wp_handle_upload($_FILES['wp-user-avatar-file'], array('test_form' => false));
391
- $type = $file['type'];
392
- // Allow only JPG, GIF, PNG
393
- if($file['error'] || !preg_match('/(jpe?g|gif|png)$/i', $type)){
394
- if($file['error']){
395
- wp_die($file['error']);
396
- } else {
397
  wp_die(__('Sorry, this file type is not permitted for security reasons.'));
398
  }
399
  }
@@ -413,7 +410,8 @@ if(!class_exists('wp_user_avatar')){
413
  $attachment = array(
414
  'guid' => $url,
415
  'post_mime_type' => $type,
416
- 'post_title' => $title
 
417
  );
418
  // This should never be set as it would then overwrite an existing attachment
419
  if(isset($attachment['ID'])){
@@ -475,8 +473,10 @@ if(!class_exists('wp_user_avatar')){
475
  if(current_user_can('upload_files')){
476
  wp_enqueue_script('admin-bar');
477
  wp_enqueue_media();
 
 
 
478
  }
479
- wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', array('jquery'), WPUA_VERSION, true);
480
  wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
481
  // Admin scripts
482
  if($pagenow == 'options-discussion.php' || ($pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page'] == 'wp-user-avatar')){
@@ -501,7 +501,6 @@ if(!class_exists('wp_user_avatar')){
501
 
502
  // Returns true if user has Gravatar-hosted image
503
  function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
504
- global $ssl;
505
  if(!is_object($id_or_email) && !empty($id_or_email)){
506
  // Find user by ID or e-mail address
507
  $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
@@ -509,12 +508,15 @@ if(!class_exists('wp_user_avatar')){
509
  $email = !empty($user) ? $user->user_email : "";
510
  }
511
  // Check if Gravatar image returns 200 (OK) or 404 (Not Found)
512
- if(!empty($email)){
513
- $hash = md5(strtolower(trim($email)));
514
- $gravatar = 'http'.$ssl.'://www.gravatar.com/avatar/'.$hash.'?d=404';
515
- $headers = @get_headers($gravatar);
516
- $has_gravatar = !preg_match("|200|", $headers[0]) ? false : true;
517
- }
 
 
 
518
  return $has_gravatar;
519
  }
520
 
1
  <?php
2
  /**
3
  * @package WP User Avatar
4
+ * @version 1.5.7
5
  */
6
  /*
7
  Plugin Name: WP User Avatar
9
  Description: Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar.
10
  Author: Bangbay Siboliban
11
  Author URI: http://siboliban.org/
12
+ Version: 1.5.7
13
  Text Domain: wp-user-avatar
14
  Domain Path: /lang/
15
  */
20
  }
21
 
22
  // Define paths and variables
23
+ define('WPUA_VERSION', ' 1.5.7');
24
  define('WPUA_FOLDER', basename(dirname(__FILE__)));
25
  define('WPUA_ABSPATH', trailingslashit(str_replace('\\', '/', WP_PLUGIN_DIR.'/'.WPUA_FOLDER)));
26
  define('WPUA_URLPATH', trailingslashit(plugins_url(WPUA_FOLDER)));
38
  $mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
39
  $mustache_avatar = WPUA_URLPATH.'images/wp-user-avatar-96x96.png';
40
  $mustache_admin = WPUA_URLPATH.'images/wp-user-avatar-32x32.png';
 
41
 
42
  // Check for updates
43
  $wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
387
  }
388
  $name = $_FILES['wp-user-avatar-file']['name'];
389
  $file = wp_handle_upload($_FILES['wp-user-avatar-file'], array('test_form' => false));
390
+ if(isset($_FILES['wp-user-avatar-file']['type'])){
391
+ $type = $_FILES['wp-user-avatar-file']['type'];
392
+ // Allow only JPG, GIF, PNG
393
+ if(!preg_match('/(jpe?g|gif|png)$/i', $type)){
 
 
394
  wp_die(__('Sorry, this file type is not permitted for security reasons.'));
395
  }
396
  }
410
  $attachment = array(
411
  'guid' => $url,
412
  'post_mime_type' => $type,
413
+ 'post_title' => $title,
414
+ 'post_content' => ""
415
  );
416
  // This should never be set as it would then overwrite an existing attachment
417
  if(isset($attachment['ID'])){
473
  if(current_user_can('upload_files')){
474
  wp_enqueue_script('admin-bar');
475
  wp_enqueue_media();
476
+ wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', array('jquery'), WPUA_VERSION, true);
477
+ } else {
478
+ wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar-user.js', array('jquery'), WPUA_VERSION, true);
479
  }
 
480
  wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
481
  // Admin scripts
482
  if($pagenow == 'options-discussion.php' || ($pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page'] == 'wp-user-avatar')){
501
 
502
  // Returns true if user has Gravatar-hosted image
503
  function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
 
504
  if(!is_object($id_or_email) && !empty($id_or_email)){
505
  // Find user by ID or e-mail address
506
  $user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
508
  $email = !empty($user) ? $user->user_email : "";
509
  }
510
  // Check if Gravatar image returns 200 (OK) or 404 (Not Found)
511
+ $hash = md5(strtolower(trim($email)));
512
+ $gravatar = 'http://www.gravatar.com/avatar/'.$hash.'?d=404';
513
+ $data = wp_cache_get($hash);
514
+ if(false === $data){
515
+ $response = wp_remote_head($gravatar);
516
+ $data = is_wp_error($response) ? 'not200' : $response['response']['code'];
517
+ wp_cache_set($hash, $data, $group="", $expire=60*5);
518
+ }
519
+ $has_gravatar = ($data == '200') ? true : false;
520
  return $has_gravatar;
521
  }
522