WP User Avatar - Version 1.5.1

Version Description

  • Add: Ability to disable scripts in front pages
  • Update: Uninstall options
  • Update: Translations
Download this release

Release Info

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

Code changes from version 1.5 to 1.5.1

css/wp-user-avatar.css CHANGED
@@ -1,12 +1,12 @@
1
- #wp-user-avatar-errors, #wp-user-avatar-message, #wp-readable-size-error { color: #c00; font-weight: 700; }
2
- #wp-user-avatar-message, #wp-readable-size-error { display: none; }
3
- #wp-user-avatar-preview, #wp-user-avatar-thumbnail { display: inline-block; text-align: center; vertical-align: top; }
4
- #wp-user-avatar-preview { margin-right: 10px; }
5
- #wp-user-avatar-preview img, #wp-user-avatar-thumbnail img { height: 96px; border: 1px solid #dfdfdf; display: block; }
6
- .defaultavatarpicker #wp-user-avatar-preview { width: 32px; height: 32px; margin-right: 0; display: inline-block; overflow: hidden; vertical-align: middle; }
7
- .defaultavatarpicker #wp-user-avatar-preview img { width: 32px; height: auto; border: 0; }
8
- #edit-wp-user-avatar { padding-left: 15px; }
9
- #edit-wp-user-avatar #remove-wp-user-avatar { margin-left: 10px; }
10
.hide-me, .wp-core-ui .hide-me { display: none; }
11
- #wp-user-avatar-slider { width: 22.75em; }
12
.wpua_label { display: block; }
1
+ #wpua-errors, #wpua-message, #wpua-readable-size-error, .wpua-error { color: #c00; font-weight: 700; }
2
+ #wpua-message, #wpua-readable-size-error { display: none; }
3
+ #wpua-preview, #wpua-thumbnail { display: inline-block; text-align: center; vertical-align: top; }
4
+ #wpua-preview { margin-right: 10px; }
5
+ #wpua-preview img, #wpua-thumbnail img { height: 96px; border: 1px solid #dfdfdf; display: block; }
6
+ .defaultavatarpicker #wpua-preview { width: 32px; height: 32px; margin-right: 0; display: inline-block; overflow: hidden; vertical-align: middle; }
7
+ .defaultavatarpicker #wpua-preview img { width: 32px; height: auto; border: 0; }
8
+ #wpua-edit { padding-left: 15px; }
9
+ #wpua-edit #wpua-remove { margin-left: 10px; }
10
.hide-me, .wp-core-ui .hide-me { display: none; }
11
+ #wpua-slider { width: 22.75em; }
12
.wpua_label { display: block; }
includes/tinymce.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5
5
*/
6
7
if(!defined('ABSPATH')){
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.1
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:295,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"}}});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.1"}}});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
5
*/
6
7
if(!defined('ABSPATH')){
@@ -11,7 +11,7 @@ if(!defined('ABSPATH')){
11
?>
12
<html xmlns="http://www.w3.org/1999/xhtml">
13
<head>
14
- <title>WP User Avatar</title>
15
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
16
<base target="_self" />
17
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/jquery.js"></script>
@@ -34,7 +34,7 @@ if(!defined('ABSPATH')){
34
var size_tag = (size != '' && size_number == '') ? ' size="' + size + '"' : '';
35
size_tag = (size_number != '') ? ' size="' + size_number + '"' : size_tag;
36
var align_tag = (align != '') ? ' align="' + align + '"' : '';
37
- var link_tag = (link != '' && link_external == '') ? ' link="' + link + '"' : '';
38
link_tag = (link_external != '') ? ' link="' + link_external + '"' : link_tag;
39
var target_tag = document.getElementById('wp_user_avatar_target').checked && (link_tag != '') ? ' target="' + target + '"' : '';
40
@@ -47,19 +47,28 @@ if(!defined('ABSPATH')){
47
}
48
return;
49
}
50
</script>
51
<style type="text/css">
52
form { background: #fff; border: 1px solid #eee; }
53
p, h4 { margin: 0; padding: 12px 0 0; }
54
h4.center { text-align: center; }
55
- label { width: 90px; display: inline-block; text-align: right; }
56
.mceActionPanel { padding: 7px 0 12px; text-align: center; }
57
.mceActionPanel #insert { float: none; width: 180px; margin: 0 auto; }
58
</style>
59
</head>
60
<body id="link" class="wp-core-ui" onload="document.body.style.display='';" style="display:none;">
61
<form name="wpUserAvatar" action="#">
62
- <p><label for="<?php esc_attr_e('wp_user_avatar_user'); ?>"><strong><?php _e('User', 'wp-user-avatar'); ?>:</strong></label>
63
<select id="<?php esc_attr_e('wp_user_avatar_user'); ?>" name="<?php esc_attr_e('wp_user_avatar_user'); ?>">
64
<option value=""></option>
65
<?php $users = get_users(); foreach($users as $user) : ?>
@@ -67,18 +76,20 @@ if(!defined('ABSPATH')){
67
<?php endforeach; ?>
68
</select></p>
69
70
- <h4 class="center"><?php _e('Choose a preset size or enter a number value', 'wp-user-avatar'); ?>.</h4>
71
-
72
<p>
73
<label for="<?php esc_attr_e('wp_user_avatar_size'); ?>"><strong><?php _e('Size'); ?>:</strong></label>
74
<select id="<?php esc_attr_e('wp_user_avatar_size'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>">
75
<option value=""></option>
76
- <option value="original"><?php _e('Original'); ?></option>
77
<option value="large"><?php _e('Large'); ?></option>
78
<option value="medium"><?php _e('Medium'); ?></option>
79
<option value="thumbnail"><?php _e('Thumbnail'); ?></option>
80
</select>
81
- <?php _e('or', 'wp-user-avatar'); ?>
82
<input type="text" size="8" id="<?php esc_attr_e('wp_user_avatar_size_number'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>" value="" />
83
</p>
84
@@ -90,19 +101,18 @@ if(!defined('ABSPATH')){
90
<option value="right"><?php _e('Right'); ?></option>
91
</select></p>
92
93
- <h4 class="center"><?php _e('Link to image file, attachment page, or custom URL', 'wp-user-avatar'); ?>.</h4>
94
-
95
<p>
96
<label for="<?php esc_attr_e('wp_user_avatar_link'); ?>"><strong><?php _e('Link To'); ?>:</strong></label>
97
<select id="<?php esc_attr_e('wp_user_avatar_link'); ?>" name="<?php esc_attr_e('wp_user_avatar_link'); ?>">
98
<option value=""></option>
99
<option value="file"><?php _e('Image File'); ?></option>
100
<option value="attachment"><?php _e('Attachment Page'); ?></option>
101
</select>
102
</p>
103
104
- <p>
105
- <label for="<?php esc_attr_e('wp_user_avatar_link_external'); ?>"><?php _e('or', 'wp-user-avatar'); ?></label>
106
<input type="text" size="36" id="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" name="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" value="" />
107
</p>
108
@@ -112,7 +122,7 @@ if(!defined('ABSPATH')){
112
</p>
113
114
<div class="mceActionPanel">
115
- <input type="submit" id="insert" class="button-primary" name="insert" value="<?php _e('Insert'); ?> <?php _e('WP User Avatar'); ?>" onclick="insert_wp_user_avatar();" />
116
</div>
117
</form>
118
</body>
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.1
5
*/
6
7
if(!defined('ABSPATH')){
11
?>
12
<html xmlns="http://www.w3.org/1999/xhtml">
13
<head>
14
+ <title><?php _e('WP User Avatar', 'wp-user-avatar'); ?></title>
15
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
16
<base target="_self" />
17
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/jquery.js"></script>
34
var size_tag = (size != '' && size_number == '') ? ' size="' + size + '"' : '';
35
size_tag = (size_number != '') ? ' size="' + size_number + '"' : size_tag;
36
var align_tag = (align != '') ? ' align="' + align + '"' : '';
37
+ var link_tag = (link != '' && link != 'custom-url' && link_external == '') ? ' link="' + link + '"' : '';
38
link_tag = (link_external != '') ? ' link="' + link_external + '"' : link_tag;
39
var target_tag = document.getElementById('wp_user_avatar_target').checked && (link_tag != '') ? ' target="' + target + '"' : '';
40
47
}
48
return;
49
}
50
+ jQuery(function(){
51
+ jQuery('#wp_user_avatar_link').change(function(){
52
+ jQuery('#wp_user_avatar_link_external_section').toggle(jQuery('#wp_user_avatar_link').val() == 'custom-url');
53
+ });
54
+ jQuery('#wp_user_avatar_size').change(function(){
55
+ jQuery('#wp_user_avatar_size_number_section').toggle(jQuery('#wp_user_avatar_size').val() == 'custom');
56
+ });
57
+ });
58
</script>
59
<style type="text/css">
60
form { background: #fff; border: 1px solid #eee; }
61
p, h4 { margin: 0; padding: 12px 0 0; }
62
h4.center { text-align: center; }
63
+ label { width: 150px; display: inline-block; text-align: right; }
64
.mceActionPanel { padding: 7px 0 12px; text-align: center; }
65
.mceActionPanel #insert { float: none; width: 180px; margin: 0 auto; }
66
+ #wp_user_avatar_size_number_section, #wp_user_avatar_link_external_section { display: none; }
67
</style>
68
</head>
69
<body id="link" class="wp-core-ui" onload="document.body.style.display='';" style="display:none;">
70
<form name="wpUserAvatar" action="#">
71
+ <p><label for="<?php esc_attr_e('wp_user_avatar_user'); ?>"><strong><?php _e('User Name'); ?>:</strong></label>
72
<select id="<?php esc_attr_e('wp_user_avatar_user'); ?>" name="<?php esc_attr_e('wp_user_avatar_user'); ?>">
73
<option value=""></option>
74
<?php $users = get_users(); foreach($users as $user) : ?>
76
<?php endforeach; ?>
77
</select></p>
78
79
<p>
80
<label for="<?php esc_attr_e('wp_user_avatar_size'); ?>"><strong><?php _e('Size'); ?>:</strong></label>
81
<select id="<?php esc_attr_e('wp_user_avatar_size'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>">
82
<option value=""></option>
83
+ <option value="original"><?php _e('Original Size'); ?></option>
84
<option value="large"><?php _e('Large'); ?></option>
85
<option value="medium"><?php _e('Medium'); ?></option>
86
<option value="thumbnail"><?php _e('Thumbnail'); ?></option>
87
+ <option value="custom"><?php _e('Custom'); ?></option>
88
</select>
89
+ </p>
90
+
91
+ <p id="<?php esc_attr_e('wp_user_avatar_size_number_section'); ?>">
92
+ <label for="<?php esc_attr_e('wp_user_avatar_size_number'); ?>"><?php _e('Size'); ?></label>
93
<input type="text" size="8" id="<?php esc_attr_e('wp_user_avatar_size_number'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>" value="" />
94
</p>
95
101
<option value="right"><?php _e('Right'); ?></option>
102
</select></p>
103
104
<p>
105
<label for="<?php esc_attr_e('wp_user_avatar_link'); ?>"><strong><?php _e('Link To'); ?>:</strong></label>
106
<select id="<?php esc_attr_e('wp_user_avatar_link'); ?>" name="<?php esc_attr_e('wp_user_avatar_link'); ?>">
107
<option value=""></option>
108
<option value="file"><?php _e('Image File'); ?></option>
109
<option value="attachment"><?php _e('Attachment Page'); ?></option>
110
+ <option value="custom-url"><?php _e('Custom URL'); ?></option>
111
</select>
112
</p>
113
114
+ <p id="<?php esc_attr_e('wp_user_avatar_link_external_section'); ?>">
115
+ <label for="<?php esc_attr_e('wp_user_avatar_link_external'); ?>"><?php _e('URL'); ?></label>
116
<input type="text" size="36" id="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" name="<?php esc_attr_e('wp_user_avatar_link_external'); ?>" value="" />
117
</p>
118
122
</p>
123
124
<div class="mceActionPanel">
125
+ <input type="submit" id="insert" class="button-primary" name="insert" value="<?php _e('Insert into Post'); ?>" onclick="insert_wp_user_avatar();" />
126
</div>
127
</form>
128
</body>
js/wp-user-avatar.js CHANGED
@@ -1 +1 @@
1
- eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5 1a(c,d,f){0.7.n={K:5(){r 0.7.u.x.j.o},O:5(a){t b=0.7.u.x;b.j.o=a;b.j.M=2(\'1h.l-1g\').B(\'C\').F(\'G\');H(b.j.o){S(b.j.o,b.j.M);2(\'#I\').L(\'i\')}},s:5(){H(3.8){r 3.8}3.8=0.7({v:\'Q\',1f:[1e 0.7.1d.1c({Y:d+": "+c})]});3.8.h(\'N\',5(){t a=3.v().K(\'m\');A=2(\'#0-4-6\').D();l=0.7.l(A);l.19();a.E(l?[l]:[])},3.8);3.8.h(\'18:17:p\',5(a){3.16(a,{Z:f})},3.8);3.8.v(\'Q\').h(\'p\',3.p);r 3.8},p:5(a){t b=0.7.u.x,m=3.K(\'m\').1b();0.7.n.O(m?m.A:-1)},X:5(){2(\'z\').h(\'i\',\'#E-0-4-6\',5(e){e.J();e.10();0.7.n.s().N()})}};2(0.7.n.X)}5 11(a,b){2(\'z\').h(\'i\',\'#E-0-4-6\',5(e){e.J();12(\'13 14 15: \'+a,b)})}5 S(a,b){2(\'#0-4-6\',9.g.k).D(a);2(\'#0-4-6-P\',9.g.k).B(\'C\').F(\'G\',b).q(\'V\',\'\').q(\'U\',\'\');2(\'#0-4-6-T\',9.g.k).w();2(\'#R-0-4-6\',9.g.k).w();2(\'#0-4-6-W\',9.g.k).y();2(\'#I\',9.g.k).L(\'i\');H(1i(0)!=\'1j\'){0.7.n.s().1k()}1l{9.g.1m()}}5 1n(a){2(\'z\').h(\'i\',\'#R-0-4-6\',5(e){e.J();2(3).y();2(\'#1o-0-4-6, #0-4-6-W\').y();2(\'#0-4-6-P\').B(\'C\').F(\'G\',a).q(\'V\',\'\').q(\'U\',\'\');2(\'#0-4-6\').D(\'\');2(\'#0-4-6-T\').w();2(\'#I\').L(\'i\')})}',62,87,'wp||jQuery|this|user|function|avatar|media|_frame|window|||||||parent|on|click|post|document|attachment|selection|wpUserAvatar|wpUserAvatarId|select|removeAttr|return|frame|var|view|state|show|settings|hide|body|id|find|img|val|add|attr|src|if|wp_user_avatar_radio|preventDefault|get|trigger|wpUserAvatarSrc|open|set|preview|library|remove|setWPUserAvatar|message|height|width|thumbnail|init|title|text|stopPropagation|openThickboxUploader|tb_show|WP|User|Avatar|createSelectToolbar|create|toolbar|fetch|openMediaUploader|single|Library|controller|new|states|info|div|typeof|undefined|close|else|tb_remove|removeWPUserAvatar|edit'.split('|'),0,{}))
1
+ function openMediaUploader(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){setWPUserAvatar(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 openThickboxUploader(a,b){jQuery('body').on('click','#wpua-add',function(e){e.preventDefault();tb_show('WP User Avatar: '+a,b)})}function setWPUserAvatar(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).show();jQuery('#wpua-thumbnail',window.parent.document).hide();jQuery('#wp_user_avatar_radio',window.parent.document).trigger('click');if(typeof(wp)!='undefined'){wp.media.wpUserAvatar.frame().close()}else{window.parent.tb_remove()}}function removeWPUserAvatar(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')})}
lang/wp-user-avatar-de_DE.mo CHANGED
Binary file
lang/wp-user-avatar-de_DE.po CHANGED
@@ -4,90 +4,45 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
- "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
- "Last-Translator: Google Translate\n"
12
- "Language-Team: Google Translate\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:881
18
- msgid "Add avatar button to Visual Editor"
19
- msgstr "In avatar-Taste, um Visueller Editor"
20
-
21
- #: wp-user-avatar.php:885
22
- msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
- msgstr "Erlauben Anbieter & Abonnenten Avatare hochladen"
24
-
25
- #: wp-user-avatar.php:327
26
- msgid "Allowed file formats"
27
- msgstr "Erlaubte Dateiformate"
28
29
- #: wp-user-avatar.php:889
30
- msgid "Disable Gravatar &mdash; Use only local avatars"
31
- msgstr "Deaktivieren Gravatar &mdash; Verwenden Sie nur lokale Avatare"
32
-
33
- #: wp-user-avatar.php:320
34
- #: wp-user-avatar.php:331
35
- #: wp-user-avatar.php:500
36
- #: wp-user-avatar.php:508
37
- msgid "Edit WP User Avatar"
38
- msgstr "WP User Avatar bearbeiten"
39
-
40
- #: wp-user-avatar.php:327
41
- msgid "JPG, GIF, PNG"
42
- msgstr "JPG, GIF, PNG"
43
44
- #: wp-user-avatar.php:335
45
- msgid "Original"
46
- msgstr "Original"
47
48
- #: wp-user-avatar.php:342
49
- #: wp-user-avatar.php:508
50
- msgid "Press %s to save your changes"
51
- msgstr "Drücken %s um Ihre Änderungen zu speichern"
52
53
- #: wp-user-avatar.php:351
54
- #: wp-user-avatar.php:500
55
- msgid "Set WP User Avatar"
56
- msgstr "WP User Avatar festlegen"
57
58
- #: wp-user-avatar.php:895
59
msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
- msgstr "Hochladen Size Limit (nur für Autoren & Abonnenten)"
61
-
62
- #: wp-user-avatar.php:899
63
- msgid "Upload Size Limit cannot be larger than the maximum"
64
- msgstr "Hochladen Size Limit kann nicht größer sein als die maximale"
65
-
66
- #: wp-user-avatar.php:875
67
- #: wp-user-avatar.php:878
68
- msgid "WP User Avatar Settings"
69
- msgstr "Einstellungen > WP User Avatar"
70
-
71
- #: window.php:70
72
- msgid "Choose a preset size or enter a number value"
73
- msgstr "Wählen Sie eine voreingestellte Größe oder geben Sie einen Zahlenwert"
74
-
75
- #: window.php:93
76
- msgid "Link to image file, attachment page, or custom URL"
77
- msgstr "Link zur Bild-Datei, Anhang-Seite, oder benutzerdefinierte URL"
78
-
79
- #: window.php:62
80
- msgid "User"
81
- msgstr "Benutzer"
82
-
83
- #: window.php:81
84
- #: window.php:105
85
- msgid "or"
86
- msgstr "oder"
87
88
#. Plugin Name of the plugin/theme
89
msgid "WP User Avatar"
90
- msgstr "WP User Avatar"
91
92
#. Plugin URI of the plugin/theme
93
msgid "http://wordpress.org/plugins/wp-user-avatar/"
@@ -95,7 +50,7 @@ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
96
#. Description of the plugin/theme
97
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
- msgstr "Verwenden Sie ein beliebiges Bild in Ihrem WordPress Mediathek als benutzerdefinierte avatar. Fügen Sie Ihre eigenen Standardavatar."
99
100
#. Author of the plugin/theme
101
msgid "Bangbay Siboliban"
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.1\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-25 00:00-0000\n"
11
+ "Last-Translator: WP User Avatar\n"
12
+ "Language-Team: WP User Avatar\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:345
18
+ #: wp-user-avatar.php:812
19
+ msgid "Click %s to save your changes"
20
+ msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
21
22
+ #: wp-user-avatar.php:886
23
+ msgid "Add avatar button to Visual Editor"
24
+ msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
25
26
+ #: wp-user-avatar.php:890
27
+ msgid "Allow Contributors & Subscribers to upload avatars"
28
+ msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
29
30
+ #: wp-user-avatar.php:894
31
+ msgid "Disable Gravatar and use only local avatars"
32
+ msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
33
34
+ #: wp-user-avatar.php:898
35
+ msgid "Allow users to upload avatars in front pages"
36
+ msgstr "Benutzer erlaubt, Avatare im Front-End hochladen"
37
38
+ #: wp-user-avatar.php:906
39
+ #: wp-user-avatar.php:911
40
msgid "Upload Size Limit (only for Contributors & Subscribers)"
41
+ msgstr "Dateigrößenbeschränkung (nur für Mitarbeiter und Abonnenten)"
42
43
#. Plugin Name of the plugin/theme
44
msgid "WP User Avatar"
45
+ msgstr "WP-Benutzer-Avatar"
46
47
#. Plugin URI of the plugin/theme
48
msgid "http://wordpress.org/plugins/wp-user-avatar/"
50
51
#. Description of the plugin/theme
52
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
53
+ msgstr "Verwenden Sie ein beliebiges Bild aus Ihrer WordPress-Mediathek als ihren Benutzer-Avatar. Fügen Sie einen eigenen Standardavatar hinzu."
54
55
#. Author of the plugin/theme
56
msgid "Bangbay Siboliban"
lang/wp-user-avatar-es_ES.mo CHANGED
Binary file
lang/wp-user-avatar-es_ES.po CHANGED
@@ -4,90 +4,45 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
- "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
- "Last-Translator: Google Translate\n"
12
- "Language-Team: Google Translate\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:881
18
- msgid "Add avatar button to Visual Editor"
19
- msgstr "Agregar botón avatar a Editor visual"
20
-
21
- #: wp-user-avatar.php:885
22
- msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
- msgstr "Permitir colaboradores y suscriptores cargar avatares"
24
-
25
- #: wp-user-avatar.php:327
26
- msgid "Allowed file formats"
27
- msgstr "Formatos de archivo permitidos"
28
29
- #: wp-user-avatar.php:889
30
- msgid "Disable Gravatar &mdash; Use only local avatars"
31
- msgstr "Desactivar Gravatar &mdash; Utilice sólo los avatares locales"
32
-
33
- #: wp-user-avatar.php:320
34
- #: wp-user-avatar.php:331
35
- #: wp-user-avatar.php:500
36
- #: wp-user-avatar.php:508
37
- msgid "Edit WP User Avatar"
38
- msgstr "Editar WP User Avatar"
39
-
40
- #: wp-user-avatar.php:327
41
- msgid "JPG, GIF, PNG"
42
- msgstr "JPG, GIF, PNG"
43
44
- #: wp-user-avatar.php:335
45
- msgid "Original"
46
- msgstr "Original"
47
48
- #: wp-user-avatar.php:342
49
- #: wp-user-avatar.php:508
50
- msgid "Press %s to save your changes"
51
- msgstr "Presione %s para guardar los cambios"
52
53
- #: wp-user-avatar.php:351
54
- #: wp-user-avatar.php:500
55
- msgid "Set WP User Avatar"
56
- msgstr "Asignar WP User Avatar"
57
58
- #: wp-user-avatar.php:895
59
msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
- msgstr "Sube límite de tamaño (sólo para colaboradores y suscriptores)"
61
-
62
- #: wp-user-avatar.php:899
63
- msgid "Upload Size Limit cannot be larger than the maximum"
64
- msgstr "Sube límite de tamaño no puede ser mayor que el máximo"
65
-
66
- #: wp-user-avatar.php:875
67
- #: wp-user-avatar.php:878
68
- msgid "WP User Avatar Settings"
69
- msgstr "Ajustes de WP User Avatar"
70
-
71
- #: window.php:70
72
- msgid "Choose a preset size or enter a number value"
73
- msgstr "Elija un tamaño preestablecido o escriba un valor numérico"
74
-
75
- #: window.php:93
76
- msgid "Link to image file, attachment page, or custom URL"
77
- msgstr "Enlazado a archivo de imagen, página de adjuntos o URL personalizada"
78
-
79
- #: window.php:62
80
- msgid "User"
81
- msgstr "Usuario"
82
-
83
- #: window.php:81
84
- #: window.php:105
85
- msgid "or"
86
- msgstr "o"
87
88
#. Plugin Name of the plugin/theme
89
msgid "WP User Avatar"
90
- msgstr "WP User Avatar"
91
92
#. Plugin URI of the plugin/theme
93
msgid "http://wordpress.org/plugins/wp-user-avatar/"
@@ -95,7 +50,7 @@ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
96
#. Description of the plugin/theme
97
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
- msgstr "Utilice cualquier imagen en tu Librería multimedia como un avatar de usuario personalizada. Haz tu propia Avatar por defecto."
99
100
#. Author of the plugin/theme
101
msgid "Bangbay Siboliban"
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.1\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-25 00:00-0000\n"
11
+ "Last-Translator: WP User Avatar\n"
12
+ "Language-Team: WP User Avatar\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:345
18
+ #: wp-user-avatar.php:812
19
+ msgid "Click %s to save your changes"
20
+ msgstr "Haz clic %s para guardar los cambios"
21
22
+ #: wp-user-avatar.php:886
23
+ msgid "Add avatar button to Visual Editor"
24
+ msgstr "Añadir botón avatar al editor visual"
25
26
+ #: wp-user-avatar.php:890
27
+ msgid "Allow Contributors & Subscribers to upload avatars"
28
+ msgstr "Permitir los colaboradores y los suscriptores subir avatares"
29
30
+ #: wp-user-avatar.php:894
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:898
35
+ msgid "Allow users to upload avatars in front pages"
36
+ msgstr "Permitir a los usuarios subir avatares en el páginas frontales"
37
38
+ #: wp-user-avatar.php:906
39
+ #: wp-user-avatar.php:911
40
msgid "Upload Size Limit (only for Contributors & Subscribers)"
41
+ msgstr "Sube límite de tamaño (para colaboradores y suscriptores)"
42
43
#. Plugin Name of the plugin/theme
44
msgid "WP User Avatar"
45
+ msgstr "WP-Usuario-Avatar"
46
47
#. Plugin URI of the plugin/theme
48
msgid "http://wordpress.org/plugins/wp-user-avatar/"
50
51
#. Description of the plugin/theme
52
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
53
+ msgstr "Utiliza cualquier imagen en tu Librería multimedia de WordPress como un avatar personalizado. Añade tu propia Avatar por defecto."
54
55
#. Author of the plugin/theme
56
msgid "Bangbay Siboliban"
lang/wp-user-avatar-fr_FR.mo CHANGED
Binary file
lang/wp-user-avatar-fr_FR.po CHANGED
@@ -4,90 +4,45 @@
4
#
5
msgid ""
6
msgstr ""
7
- "Project-Id-Version: WP User Avatar 1.5\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
- "PO-Revision-Date: 2013-06-17 00:00-0000\n"
11
- "Last-Translator: Google Translate\n"
12
- "Language-Team: Google Translate\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
- #: wp-user-avatar.php:881
18
- msgid "Add avatar button to Visual Editor"
19
- msgstr "Ajouter bouton avatar sur Éditeur visuel"
20
-
21
- #: wp-user-avatar.php:885
22
- msgid "Allow Contributors &amp; Subscribers to upload avatars"
23
- msgstr "Permettre aux contributeurs et aux abonnés d'envoyer avatars"
24
-
25
- #: wp-user-avatar.php:327
26
- msgid "Allowed file formats"
27
- msgstr "Formats acceptés"
28
29
- #: wp-user-avatar.php:889
30
- msgid "Disable Gravatar &mdash; Use only local avatars"
31
- msgstr "Désactiver Gravatar &mdash; Utilisez seulement des avatars locaux"
32
-
33
- #: wp-user-avatar.php:320
34
- #: wp-user-avatar.php:331
35
- #: wp-user-avatar.php:500
36
- #: wp-user-avatar.php:508
37
- msgid "Edit WP User Avatar"
38
- msgstr "Modifier WP User Avatar"
39
-
40
- #: wp-user-avatar.php:327
41
- msgid "JPG, GIF, PNG"
42
- msgstr "JPG, GIF, PNG"
43
44
- #: wp-user-avatar.php:335
45
- msgid "Original"
46
- msgstr "Originale"
47
48
- #: wp-user-avatar.php:342
49
- #: wp-user-avatar.php:508
50
- msgid "Press %s to save your changes"
51
- msgstr "Appuyez %s pour enregistrer vos modifications"
52
53
- #: wp-user-avatar.php:351
54
- #: wp-user-avatar.php:500
55
- msgid "Set WP User Avatar"
56
- msgstr "Utiliser WP User Avatar"
57
58
- #: wp-user-avatar.php:895
59
msgid "Upload Size Limit (only for Contributors & Subscribers)"
60
- msgstr "Téléchargez limite de taille (seulement pour les contributeurs et abonnés)"
61
-
62
- #: wp-user-avatar.php:899
63
- msgid "Upload Size Limit cannot be larger than the maximum"
64
- msgstr "Téléchargez la limite de taille ne peut pas être supérieure au maximum"
65
-
66
- #: wp-user-avatar.php:875
67
- #: wp-user-avatar.php:878
68
- msgid "WP User Avatar Settings"
69
- msgstr "Réglages de WP User Avatar"
70
-
71
- #: window.php:70
72
- msgid "Choose a preset size or enter a number value"
73
- msgstr "Choisissez une taille prédéfinie ou entrez une valeur numérique"
74
-
75
- #: window.php:93
76
- msgid "Link to image file, attachment page, or custom URL"
77
- msgstr "Lier à fichier d'image, page du fichier attaché ou lien personnalisé"
78
-
79
- #: window.php:62
80
- msgid "User"
81
- msgstr "Utilisateur"
82
-
83
- #: window.php:81
84
- #: window.php:105
85
- msgid "or"
86
- msgstr "ou"
87
88
#. Plugin Name of the plugin/theme
89
msgid "WP User Avatar"
90
- msgstr "WP User Avatar"
91
92
#. Plugin URI of the plugin/theme
93
msgid "http://wordpress.org/plugins/wp-user-avatar/"
@@ -95,7 +50,7 @@ msgstr "http://wordpress.org/plugins/wp-user-avatar/"
95
96
#. Description of the plugin/theme
97
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
98
- msgstr "Utilisez n'importe quelle image dans votre médiathèque WordPress comme un avatar de l'utilisateur personnalisé. Ajoutez votre propre avatar par défaut."
99
100
#. Author of the plugin/theme
101
msgid "Bangbay Siboliban"
4
#
5
msgid ""
6
msgstr ""
7
+ "Project-Id-Version: WP User Avatar 1.5.1\n"
8
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
9
"POT-Creation-Date: 2013-06-17 00:00-0000\n"
10
+ "PO-Revision-Date: 2013-06-25 00:00-0000\n"
11
+ "Last-Translator: WP User Avatar\n"
12
+ "Language-Team: WP User Avatar\n"
13
"MIME-Version: 1.0\n"
14
"Content-Type: text/plain; charset=UTF-8\n"
15
"Content-Transfer-Encoding: 8bit\n"
16
17
+ #: wp-user-avatar.php:345
18
+ #: wp-user-avatar.php:812
19
+ msgid "Click %s to save your changes"
20
+ msgstr "Cliquez sur %s pour enregistrer vos modifications"
21
22
+ #: wp-user-avatar.php:886
23
+ msgid "Add avatar button to Visual Editor"
24
+ msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
25
26
+ #: wp-user-avatar.php:890
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:894
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:898
35
+ msgid "Allow users to upload avatars in front pages"
36
+ msgstr "Permettre aux utilisateurs d'envoyer dans les pages frontales"
37
38
+ #: wp-user-avatar.php:906
39
+ #: wp-user-avatar.php:911
40
msgid "Upload Size Limit (only for Contributors & Subscribers)"
41
+ msgstr "Taille limite d'envoi de fichiers (pour contributeurs et abonnés)"
42
43
#. Plugin Name of the plugin/theme
44
msgid "WP User Avatar"
45
+ msgstr "WP-Utilisateur-Avatar"
46
47
#. Plugin URI of the plugin/theme
48
msgid "http://wordpress.org/plugins/wp-user-avatar/"
50
51
#. Description of the plugin/theme
52
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
53
+ msgstr "Utiliser n'importe quelle image dans votre Bibliothèque de médias de WordPress comme un avatar personnalisé. Ajouter votre propre avatar par défaut."
54
55
#. Author of the plugin/theme
56
msgid "Bangbay Siboliban"
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.4
7
- Tested up to: 3.5.1
8
- Stable tag: 1.5
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
@@ -29,7 +29,7 @@ This plugin uses the Media uploader introduced in WordPress 3.5, but is also bac
29
== Installation ==
30
31
1. Download, install, and activate the WP User Avatar plugin.
32
- 2. On your edit profile page, click "Edit WP User Avatar".
33
3. Choose an image, then click "Set WP User Avatar".
34
4. Click "Update Profile".
35
5. Upload your own Default Avatar in your WP User Avatar settings (optional). You can also allow Contributors & Subscribers to upload avatars and disable Gravatar.
@@ -225,13 +225,18 @@ Outputs:
225
226
1. WP User Avatar admin settings.
227
2. WP User Avatar lets you upload your own Default Avatar.
228
- 3. WP User Avatar adds a field to your edit profile page.
229
4. After you've chosen a WP User Avatar image, you will see the option to remove it.
230
5. WP User Avatar adds a button to insert the [avatar] shortcode in the Visual Editor.
231
6. Options for the [avatar] shortcode.
232
233
== Changelog ==
234
235
= 1.5 =
236
* Add: Ability to disable Gravatar avatars
237
* Add: Upload size limiter for Contributors & Subscribers
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.4
7
+ Tested up to: 3.5.2
8
+ Stable tag: 1.5.1
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
29
== Installation ==
30
31
1. Download, install, and activate the WP User Avatar plugin.
32
+ 2. On your profile edit page, click "Edit WP User Avatar".
33
3. Choose an image, then click "Set WP User Avatar".
34
4. Click "Update Profile".
35
5. Upload your own Default Avatar in your WP User Avatar settings (optional). You can also allow Contributors & Subscribers to upload avatars and disable Gravatar.
225
226
1. WP User Avatar admin settings.
227
2. WP User Avatar lets you upload your own Default Avatar.
228
+ 3. WP User Avatar adds a field to your profile edit page.
229
4. After you've chosen a WP User Avatar image, you will see the option to remove it.
230
5. WP User Avatar adds a button to insert the [avatar] shortcode in the Visual Editor.
231
6. Options for the [avatar] shortcode.
232
233
== Changelog ==
234
235
+ = 1.5.1 =
236
+ * Add: Ability to disable scripts in front pages
237
+ * Update: Uninstall options
238
+ * Update: Translations
239
+
240
= 1.5 =
241
* Add: Ability to disable Gravatar avatars
242
* Add: Upload size limiter for Contributors & Subscribers
uninstall.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5
5
*/
6
7
// Remove user metadata and options on plugin delete
@@ -24,6 +24,9 @@ if(is_multisite()){
24
delete_option('avatar_default_wp_user_avatar');
25
delete_option('wp_user_avatar_tinymce');
26
delete_option('wp_user_avatar_allow_upload');
27
delete_option('wp_user_avatar_default_avatar_updated');
28
delete_option('wp_user_avatar_users_updated');
29
delete_option('wp_user_avatar_media_updated');
@@ -35,6 +38,9 @@ if(is_multisite()){
35
delete_option('avatar_default_wp_user_avatar');
36
delete_option('wp_user_avatar_tinymce');
37
delete_option('wp_user_avatar_allow_upload');
38
delete_option('wp_user_avatar_default_avatar_updated');
39
delete_option('wp_user_avatar_users_updated');
40
delete_option('wp_user_avatar_media_updated');
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.1
5
*/
6
7
// Remove user metadata and options on plugin delete
24
delete_option('avatar_default_wp_user_avatar');
25
delete_option('wp_user_avatar_tinymce');
26
delete_option('wp_user_avatar_allow_upload');
27
+ delete_option('wp_user_avatar_disable_gravatar');
28
+ delete_option('wp_user_avatar_load_scripts');
29
+ delete_option('wp_user_avatar_upload_size_limit');
30
delete_option('wp_user_avatar_default_avatar_updated');
31
delete_option('wp_user_avatar_users_updated');
32
delete_option('wp_user_avatar_media_updated');
38
delete_option('avatar_default_wp_user_avatar');
39
delete_option('wp_user_avatar_tinymce');
40
delete_option('wp_user_avatar_allow_upload');
41
+ delete_option('wp_user_avatar_disable_gravatar');
42
+ delete_option('wp_user_avatar_load_scripts');
43
+ delete_option('wp_user_avatar_upload_size_limit');
44
delete_option('wp_user_avatar_default_avatar_updated');
45
delete_option('wp_user_avatar_users_updated');
46
delete_option('wp_user_avatar_media_updated');
wp-user-avatar.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* @package WP User Avatar
4
- * @version 1.5
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
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');
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)));
@@ -32,6 +32,7 @@ $show_avatars = get_option('show_avatars');
32
$wpua_tinymce = get_option('wp_user_avatar_tinymce');
33
$wpua_allow_upload = get_option('wp_user_avatar_allow_upload');
34
$wpua_disable_gravatar = get_option('wp_user_avatar_disable_gravatar');
35
$mustache_original = WPUA_URLPATH.'images/wp-user-avatar.png';
36
$mustache_medium = WPUA_URLPATH.'images/wp-user-avatar-300x300.png';
37
$mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
@@ -71,7 +72,7 @@ if($wpua_user_upload_size_limit > 1024){
71
$wpua_upload_size_limit_with_units = (int) $wpua_user_upload_size_limit.'KB';
72
73
// Load add-ons
74
- if($wpua_tinymce == 1){
75
include_once(WPUA_ABSPATH.'includes/tinymce.php');
76
}
77
@@ -86,10 +87,14 @@ register_deactivation_hook(WPUA_ABSPATH.'wp-user-avatar.php', 'wpua_deactivate')
86
87
// Settings saved to wp_options
88
function wpua_options(){
89
- global $wp_user_roles;
90
add_option('avatar_default_wp_user_avatar', "");
91
add_option('wp_user_avatar_tinymce', '1');
92
add_option('wp_user_avatar_allow_upload', '0');
93
add_option('wp_user_avatar_disable_gravatar', '0');
94
add_option('wp_user_avatar_upload_size_limit', '0');
95
}
@@ -147,13 +152,13 @@ if(empty($wpua_media_updated)){
147
foreach($wpuas as $usermeta){
148
add_post_meta($usermeta->meta_value, '_wp_attachment_wp_user_avatar', $usermeta->user_id);
149
}
150
- update_option('wp_user_avatar_media_updated', '1');
151
}
152
add_action('admin_init', 'wpua_media_state');
153
}
154
155
// Settings for Subscribers
156
- if($wpua_allow_upload == 1){
157
// Allow multipart data in form
158
function wpua_add_edit_form_multipart_encoding(){
159
echo ' enctype="multipart/form-data"';
@@ -174,11 +179,7 @@ if($wpua_allow_upload == 1){
174
// Check user role
175
function check_user_role($role, $user_id=null){
176
global $current_user;
177
- if(is_numeric($user_id)){
178
- $user = get_userdata($user_id);
179
- } else {
180
- $user = $current_user->ID;
181
- }
182
if(empty($user)){
183
return false;
184
}
@@ -206,6 +207,16 @@ if($wpua_allow_upload == 1){
206
}
207
add_action('admin_menu', 'wpua_subscriber_remove_menu_pages');
208
209
// Remove dashboard items
210
function wpua_subscriber_remove_dashboard_widgets(){
211
global $current_user;
@@ -252,28 +263,29 @@ function wpua_deactivate(){
252
if(!class_exists('wp_user_avatar')){
253
class wp_user_avatar{
254
function wp_user_avatar(){
255
- global $current_screen, $current_user, $pagenow, $show_avatars, $wpua_allow_upload, $wpua_upload_size_limit;
256
- // Adds WPUA to profile
257
- if(current_user_can('upload_files') || ($wpua_allow_upload == 1 && is_user_logged_in())){
258
add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
259
add_action('edit_user_profile', array($this, 'wpua_action_show_user_profile'));
260
add_action('personal_options_update', array($this, 'wpua_action_process_option_update'));
261
add_action('edit_user_profile_update', array($this, 'wpua_action_process_option_update'));
262
// Prefilter upload size
263
if(!current_user_can('upload_files')){
264
- add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'), 10, 1);
265
}
266
if(is_admin()){
267
- // Adds scripts to admin
268
add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
269
// Admin settings
270
add_action('admin_menu', 'wpua_admin');
271
add_filter('plugin_action_links', array($this, 'wpua_plugin_settings_links'), 10, 2);
272
- } else {
273
if(!function_exists('get_current_screen')){
274
require_once(ABSPATH.'wp-admin/includes/screen.php');
275
}
276
- // Adds scripts to front pages
277
add_action('wp_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
278
}
279
// Only add attachment field for WP 3.4 and older
@@ -281,7 +293,7 @@ if(!class_exists('wp_user_avatar')){
281
add_filter('attachment_fields_to_edit', array($this, 'wpua_add_attachment_field_to_edit'), 10, 2);
282
}
283
// Hide column in Users table if default avatars are enabled
284
- if(is_admin() && $show_avatars != 1){
285
add_filter('manage_users_columns', array($this, 'wpua_add_column'), 10, 1);
286
add_filter('manage_users_custom_column', array($this, 'wpua_show_column'), 10, 3);
287
}
@@ -296,7 +308,7 @@ if(!class_exists('wp_user_avatar')){
296
// Show remove button if WPUA is set
297
$hide_remove = !has_wp_user_avatar($user->ID) ? ' hide-me' : "";
298
// If avatars are enabled, get original avatar image or show blank
299
- $avatar_medium_src = ($show_avatars == 1 && is_admin()) ? wpua_get_avatar_original($user->user_email, 96) : includes_url().'images/blank.gif';
300
// Check if user has wp_user_avatar, if not show image from above
301
$avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src;
302
// Check if user has wp_user_avatar, if not show image from above
@@ -317,29 +329,29 @@ if(!class_exists('wp_user_avatar')){
317
<?php endif; ?>
318
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?>" />
319
<?php if(current_user_can('upload_files')) : // Button to launch Media uploader ?>
320
- <p><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar"><?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?></button></p>
321
<?php elseif(!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) : // Upload button ?>
322
- <input name="wp-user-avatar-file" id="wp-user-avatar-file" type="file" />
323
<button type="submit" class="button" id="upload-wp-user-avatar" name="upload-wp-user-avatar" value="<?php _e('Upload'); ?>"><?php _e('Upload'); ?></button>
324
<p>
325
- <?php printf(__( 'Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units ), esc_html('KB')); ?>
326
<br />
327
- <?php _e('Allowed file formats', 'wp-user-avatar'); ?>: <?php _e('JPG, GIF, PNG', 'wp-user-avatar'); ?>
328
</p>
329
<?php elseif(!current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) : // Edit button ?>
330
<?php $edit_attachment_link = function_exists('wp_enqueue_media') ? add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')) : add_query_arg(array('attachment_id' => $wpua, 'action' => 'edit'), admin_url('media.php')) ?>
331
- <p><button type="button" class="button" id="edit-wp-user-avatar" name="edit-wp-user-avatar" onclick="window.open('<?php echo $edit_attachment_link; ?>', '_self');"><?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?></button></p>
332
<?php endif; ?>
333
- <p id="wp-user-avatar-preview">
334
<img src="<?php echo $avatar_medium; ?>" alt="" />
335
- <?php _e('Original', 'wp-user-avatar'); ?>
336
</p>
337
- <p id="wp-user-avatar-thumbnail">
338
<img src="<?php echo $avatar_thumbnail; ?>" alt="" />
339
<?php _e('Thumbnail'); ?>
340
</p>
341
- <p><button type="button" class="button<?php echo $hide_remove; ?>" id="remove-wp-user-avatar" name="remove-wp-user-avatar"><?php _e('Remove'); ?></button></p>
342
- <p id="wp-user-avatar-message"><?php printf(__('Press %s to save your changes', 'wp-user-avatar'), $profile); ?>.</p>
343
<?php if(class_exists('bbPress') && !is_admin()) : // Add to bbPress profile with same style ?>
344
</fieldset>
345
<?php else : // Add to profile with admin style ?>
@@ -437,7 +449,7 @@ if(!class_exists('wp_user_avatar')){
437
// Add button to attach image for WP 3.4 and older
438
function wpua_add_attachment_field_to_edit($fields, $post){
439
$image = wp_get_attachment_image_src($post->ID, "medium");
440
- $button = '<button type="button" class="button" id="set-wp-user-avatar-image" name="set-wp-user-avatar-image" onclick="setWPUserAvatar(\''.$post->ID.'\', \''.$image[0].'\')">'.__('Set WP User Avatar', 'wp-user-avatar').'</button>';
441
$fields['wp-user-avatar'] = array(
442
'label' => __('WP User Avatar', 'wp-user-avatar'),
443
'input' => 'html',
@@ -473,21 +485,23 @@ if(!class_exists('wp_user_avatar')){
473
// Media uploader
474
function wpua_media_upload_scripts(){
475
global $pagenow;
476
- if(function_exists('wp_enqueue_media')){
477
- wp_enqueue_script('admin-bar');
478
- wp_enqueue_media();
479
- } else {
480
- wp_enqueue_script('media-upload');
481
- wp_enqueue_script('thickbox');
482
- wp_enqueue_style('thickbox');
483
- }
484
wp_enqueue_script('jquery');
485
- wp_enqueue_script('jquery-ui-slider');
486
- wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', "", WPUA_VERSION);
487
if($pagenow == 'options-general.php'){
488
wp_enqueue_style('wp-user-avatar-jqueryui', WPUA_URLPATH.'css/jquery.ui.slider.css', "", null);
489
}
490
- wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
491
}
492
}
493
@@ -497,7 +511,7 @@ if(!class_exists('wp_user_avatar')){
497
jQuery(function(){
498
<?php if(current_user_can('upload_files')) : ?>
499
<?php if(function_exists('wp_enqueue_media')) : // Backbone uploader for WP 3.5+ ?>
500
- openMediaUploader('<?php echo $section; ?>', "<?php _e('Edit WP User Avatar', 'wp-user-avatar'); ?>", "<?php _e('Set WP User Avatar', 'wp-user-avatar'); ?>");
501
<?php else : // Fall back to Thickbox uploader ?>
502
openThickboxUploader('<?php echo $section; ?>', '<?php echo get_admin_url(); ?>media-upload.php?post_id=0&type=image&tab=library&TB_iframe=1');
503
<?php endif; ?>
@@ -794,17 +808,17 @@ if(!class_exists('wp_user_avatar')){
794
$hide_remove = ' class="hide-me"';
795
}
796
// Default Avatar is wp_user_avatar, check the radio button next to it
797
- $selected_avatar = ($avatar_default == 'wp_user_avatar' || $wpua_disable_gravatar == 1) ? ' checked="checked" ' : "";
798
// Wrap WPUA in div
799
- $avatar_thumb_img = '<div id="wp-user-avatar-preview"><img src="'.$avatar_thumb.'" width="32" /></div>';
800
// Add WPUA to list
801
$wpua_list = "\n\t<label><input type='radio' name='avatar_default' id='wp_user_avatar_radio' value='wp_user_avatar'$selected_avatar /> ";
802
$wpua_list .= preg_replace("/src='(.+?)'/", "src='\$1'", $avatar_thumb_img);
803
$wpua_list .= ' '.__('WP User Avatar', 'wp-user-avatar').'</label>';
804
- $wpua_list .= '<p id="edit-wp-user-avatar"><button type="button" class="button" id="add-wp-user-avatar" name="add-wp-user-avatar">'.__('Edit WP User Avatar', 'wp-user-avatar').'</button>';
805
- $wpua_list .= '<a href="#" id="remove-wp-user-avatar"'.$hide_remove.'>'.__('Remove').'</a></p>';
806
$wpua_list .= '<input type="hidden" id="wp-user-avatar" name="avatar_default_wp_user_avatar" value="'.$wpua_avatar_default.'">';
807
- $wpua_list .= '<p id="wp-user-avatar-message">'.sprintf(__('Press %s to save your changes', 'wp-user-avatar'), '&ldquo;'.__('Save Changes').'&rdquo;').'.</p>';
808
$wpua_list .= wpua_js(__('Default Avatar'), $mustache_admin);
809
if($wpua_disable_gravatar != 1){
810
return $wpua_list.'<div id="wp-avatars">'.$avatar_list.'</div>';
@@ -856,7 +870,7 @@ if(!class_exists('wp_user_avatar')){
856
857
// Admin page
858
function wpua_options_page(){
859
- global $upload_size_limit_with_units, $wpua_allow_upload, $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
860
// Give subscribers edit_posts capability
861
if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && empty($wpua_allow_upload)){
862
wpua_subscriber_remove_cap();
@@ -872,70 +886,83 @@ if(!class_exists('wp_user_avatar')){
872
<?php do_settings_fields('wpua-settings-group', ""); ?>
873
<table class="form-table">
874
<tr valign="top">
875
- <th scope="row"><?php _e('WP User Avatar Settings', 'wp-user-avatar'); ?></th>
876
<td>
877
<fieldset>
878
- <legend class="screen-reader-text"><span><?php _e('WP User Avatar Settings', 'wp-user-avatar'); ?>/span></legend>
879
<label for="wp_user_avatar_tinymce" class="wpua_label">
880
- <input name="wp_user_avatar_tinymce" type="checkbox" id="wp_user_avatar_tinymce" value="1" <?php checked('1', get_option('wp_user_avatar_tinymce')); ?> />
881
<?php _e('Add avatar button to Visual Editor', 'wp-user-avatar'); ?>
882
</label>
883
<label for="wp_user_avatar_allow_upload" class="wpua_label">
884
- <input name="wp_user_avatar_allow_upload" type="checkbox" id="wp_user_avatar_allow_upload" value="1" <?php checked('1', get_option('wp_user_avatar_allow_upload')); ?> />
885
- <?php _e('Allow Contributors &amp; Subscribers to upload avatars', 'wp-user-avatar'); ?>
886
</label>
887
<label for="wp_user_avatar_disable_gravatar" class="wpua_label">
888
- <input name="wp_user_avatar_disable_gravatar" type="checkbox" id="wp_user_avatar_disable_gravatar" value="1" <?php checked('1', get_option('wp_user_avatar_disable_gravatar')); ?> />
889
- <?php _e('Disable Gravatar &mdash; Use only local avatars', 'wp-user-avatar'); ?>
890
</label>
891
</fieldset>
892
</td>
893
</tr>
894
<tr id="wp-size-upload-limit-settings" valign="top"<?php echo $hide_size; ?>>
895
- <th scope="row"><label for="wp_user_avatar_upload_size_limit" class="wpua_label"><?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?></label></th>
896
<td>
897
- <input name="wp_user_avatar_upload_size_limit" type="text" id="wp_user_avatar_upload_size_limit" value="<?php echo $wpua_upload_size_limit; ?>" class="regular-text" />
898
- <span id="wp-readable-size">(<?php echo $wpua_upload_size_limit_with_units; ?>)</span>
899
- <span id="wp-readable-size-error"><?php _e('Upload Size Limit cannot be larger than the maximum', 'wp-user-avatar'); ?>.</span>
900
- <div id="wp-user-avatar-slider"></div>
901
- <script type="text/javascript">
902
- jQuery(function(){
903
- // Show size info only if allow uploads is checked
904
- jQuery('#wp_user_avatar_allow_upload').change(function(){
905
- jQuery('#wp-size-upload-limit-settings').toggle(jQuery('#wp_user_avatar_allow_upload').is(':checked'));
906
- });
907
- // Hide Gravatars if disable Gravatars is checked
908
- jQuery('#wp_user_avatar_disable_gravatar').change(function(){
909
- if(jQuery('#wp-avatars').length){
910
- jQuery('#wp-avatars').toggle(!jQuery('#wp_user_avatar_disable_gravatar').is(':checked'));
911
- jQuery('#wp_user_avatar_radio').trigger('click');
912
- }
913
- jQuery('#wp-user-avatar-message').show();
914
- });
915
- // Add size slider
916
- jQuery('#wp-user-avatar-slider').slider({
917
- value: <?php echo $wpua_upload_size_limit; ?>,
918
- min: 0,
919
- max: <?php echo wp_max_upload_size(); ?>,
920
- step: 1,
921
- slide: function(event, ui){
922
- jQuery('#wp_user_avatar_upload_size_limit').val(ui.value);
923
- jQuery('#wp-readable-size').html('(' + Math.floor(ui.value / 1024) + 'KB)');
924
- jQuery('#wp-readable-size-error').hide();
925
- }
926
- });
927
- // Update readable size on keyup
928
- jQuery('#wp_user_avatar_upload_size_limit').keyup(function(){
929
- var wpua_upload_size_limit = jQuery(this).val();
930
- wpua_upload_size_limit = wpua_upload_size_limit.replace(/\D/g, '');
931
- // jQuery(this).val(wpua_upload_size_limit);
932
- jQuery('#wp-readable-size').html('(' + Math.floor(wpua_upload_size_limit / 1024) + 'KB)');
933
- jQuery('#wp-readable-size-error').toggle(wpua_upload_size_limit > <?php echo wp_max_upload_size(); ?>);
934
});
935
- jQuery('#wp_user_avatar_upload_size_limit').val(jQuery('#wp-user-avatar-slider').slider('value'));
936
- });
937
- </script>
938
- <span class="description"><?php printf(__( 'Maximum upload file size: %d%s.'), esc_html(wp_max_upload_size()), esc_html(' bytes ('.$upload_size_limit_with_units.')')); ?></span>
939
</td>
940
</tr>
941
</table>
@@ -948,7 +975,7 @@ if(!class_exists('wp_user_avatar')){
948
<fieldset>
949
<legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
950
<label for="show_avatars">
951
- <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked('1', get_option('show_avatars')); ?> />
952
<?php _e('Show Avatars'); ?>
953
</label>
954
</fieldset>
@@ -996,6 +1023,7 @@ if(!class_exists('wp_user_avatar')){
996
register_setting('wpua-settings-group', 'wp_user_avatar_tinymce', 'intval');
997
register_setting('wpua-settings-group', 'wp_user_avatar_allow_upload', 'intval');
998
register_setting('wpua-settings-group', 'wp_user_avatar_disable_gravatar', 'intval');
999
register_setting('wpua-settings-group', 'wp_user_avatar_upload_size_limit', 'intval');
1000
register_setting('wpua-settings-group', 'show_avatars', 'intval');
1001
register_setting('wpua-settings-group', 'avatar_rating');
@@ -1005,7 +1033,7 @@ if(!class_exists('wp_user_avatar')){
1005
1006
// Add options page and settings
1007
function wpua_admin(){
1008
- add_options_page('WP User Avatar Plugin Settings', 'WP User Avatar', 'manage_options', 'wp-user-avatar', 'wpua_options_page');
1009
add_action('admin_init', 'wpua_admin_settings');
1010
}
1011
1
<?php
2
/**
3
* @package WP User Avatar
4
+ * @version 1.5.1
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.1
13
Text Domain: wp-user-avatar
14
Domain Path: /lang/
15
*/
20
}
21
22
// Define paths and variables
23
+ define('WPUA_VERSION', '1.5.1');
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)));
32
$wpua_tinymce = get_option('wp_user_avatar_tinymce');
33
$wpua_allow_upload = get_option('wp_user_avatar_allow_upload');
34
$wpua_disable_gravatar = get_option('wp_user_avatar_disable_gravatar');
35
+ $wpua_load_scripts = get_option('wp_user_avatar_load_scripts');
36
$mustache_original = WPUA_URLPATH.'images/wp-user-avatar.png';
37
$mustache_medium = WPUA_URLPATH.'images/wp-user-avatar-300x300.png';
38
$mustache_thumbnail = WPUA_URLPATH.'images/wp-user-avatar-150x150.png';
72
$wpua_upload_size_limit_with_units = (int) $wpua_user_upload_size_limit.'KB';
73
74
// Load add-ons
75
+ if((bool) $wpua_tinymce == 1){
76
include_once(WPUA_ABSPATH.'includes/tinymce.php');
77
}
78
87
88
// Settings saved to wp_options
89
function wpua_options(){
90
add_option('avatar_default_wp_user_avatar', "");
91
add_option('wp_user_avatar_tinymce', '1');
92
add_option('wp_user_avatar_allow_upload', '0');
93
+ if(class_exists('bbPress') || class_exists('theme_my_login')){
94
+ add_option('wp_user_avatar_load_scripts', '1');
95
+ } else {
96
+ add_option('wp_user_avatar_load_scripts', '0');
97
+ }
98
add_option('wp_user_avatar_disable_gravatar', '0');
99
add_option('wp_user_avatar_upload_size_limit', '0');
100
}
152
foreach($wpuas as $usermeta){
153
add_post_meta($usermeta->meta_value, '_wp_attachment_wp_user_avatar', $usermeta->user_id);
154
}
155
+ update_option('wp_user_avatar_media_updated', '1');
156
}
157
add_action('admin_init', 'wpua_media_state');
158
}
159
160
// Settings for Subscribers
161
+ if((bool) $wpua_allow_upload == 1){
162
// Allow multipart data in form
163
function wpua_add_edit_form_multipart_encoding(){
164
echo ' enctype="multipart/form-data"';
179
// Check user role
180
function check_user_role($role, $user_id=null){
181
global $current_user;
182
+ $user = is_numeric($user_id) ? get_userdata($user_id) : $current_user->ID;
183
if(empty($user)){
184
return false;
185
}
207
}
208
add_action('admin_menu', 'wpua_subscriber_remove_menu_pages');
209
210
+ // Remove menu bar items
211
+ function wpua_subscriber_remove_menu_bar_items(){
212
+ global $current_user, $wp_admin_bar;
213
+ if(check_user_role('subscriber', $current_user->ID)){
214
+ $wp_admin_bar->remove_menu('comments');
215
+ $wp_admin_bar->remove_menu('new-content');
216
+ }
217
+ }
218
+ add_action('wp_before_admin_bar_render', 'wpua_subscriber_remove_menu_bar_items');
219
+
220
// Remove dashboard items
221
function wpua_subscriber_remove_dashboard_widgets(){
222
global $current_user;
263
if(!class_exists('wp_user_avatar')){
264
class wp_user_avatar{
265
function wp_user_avatar(){
266
+ global $current_screen, $current_user, $pagenow, $show_avatars, $wpua_allow_upload, $wpua_load_scripts, $wpua_upload_size_limit;
267
+ // Add WPUA to profile
268
+ if(current_user_can('upload_files') || ((bool) $wpua_allow_upload == 1 && is_user_logged_in())){
269
add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
270
add_action('edit_user_profile', array($this, 'wpua_action_show_user_profile'));
271
add_action('personal_options_update', array($this, 'wpua_action_process_option_update'));
272
add_action('edit_user_profile_update', array($this, 'wpua_action_process_option_update'));
273
// Prefilter upload size
274
if(!current_user_can('upload_files')){
275
+ add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'), 10, 1);
276
}
277
if(is_admin()){
278
+ // Add scripts to admin
279
add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
280
// Admin settings
281
add_action('admin_menu', 'wpua_admin');
282
add_filter('plugin_action_links', array($this, 'wpua_plugin_settings_links'), 10, 2);
283
+ }
284
+ // Add scripts to front pages
285
+ if(!is_admin() && (bool) $wpua_load_scripts == 0){
286
if(!function_exists('get_current_screen')){
287
require_once(ABSPATH.'wp-admin/includes/screen.php');
288
}
289
add_action('wp_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
290
}
291
// Only add attachment field for WP 3.4 and older
293
add_filter('attachment_fields_to_edit', array($this, 'wpua_add_attachment_field_to_edit'), 10, 2);
294
}
295
// Hide column in Users table if default avatars are enabled
296
+ if(is_admin() && (bool) $show_avatars == 0){
297
add_filter('manage_users_columns', array($this, 'wpua_add_column'), 10, 1);
298
add_filter('manage_users_custom_column', array($this, 'wpua_show_column'), 10, 3);
299
}
308
// Show remove button if WPUA is set
309
$hide_remove = !has_wp_user_avatar($user->ID) ? ' hide-me' : "";
310
// If avatars are enabled, get original avatar image or show blank
311
+ $avatar_medium_src = (is_admin() && (bool) $show_avatars == 1) ? wpua_get_avatar_original($user->user_email, 96) : includes_url().'images/blank.gif';
312
// Check if user has wp_user_avatar, if not show image from above
313
$avatar_medium = has_wp_user_avatar($user->ID) ? get_wp_user_avatar_src($user->ID, 'medium') : $avatar_medium_src;
314
// Check if user has wp_user_avatar, if not show image from above
329
<?php endif; ?>
330
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?>" />
331
<?php if(current_user_can('upload_files')) : // Button to launch Media uploader ?>
332
+ <p><button type="button" class="button" id="wpua-add" name="wpua-add"><?php _e('Edit Image'); ?></button></p>
333
<?php elseif(!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) : // Upload button ?>
334
+ <input name="wp-user-avatar-file" id="wpua-file" type="file" />
335
<button type="submit" class="button" id="upload-wp-user-avatar" name="upload-wp-user-avatar" value="<?php _e('Upload'); ?>"><?php _e('Upload'); ?></button>
336
<p>
337
+ <?php printf(__('Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units), esc_html('KB')); ?>
338
<br />
339
+ <?php _e('Allowed Files'); ?>: <?php _e('<code>jpg jpeg png gif</code>'); ?>
340
</p>
341
<?php elseif(!current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) : // Edit button ?>
342
<?php $edit_attachment_link = function_exists('wp_enqueue_media') ? add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')) : add_query_arg(array('attachment_id' => $wpua, 'action' => 'edit'), admin_url('media.php')) ?>
343
+ <p><button type="button" class="button" id="wpua-edit" name="wpua-edit" onclick="window.open('<?php echo $edit_attachment_link; ?>', '_self');"><?php _e('Edit Image'); ?></button></p>
344
<?php endif; ?>
345
+ <p id="wpua-preview">
346
<img src="<?php echo $avatar_medium; ?>" alt="" />
347
+ <?php _e('Original Size'); ?>
348
</p>
349
+ <p id="wpua-thumbnail">
350
<img src="<?php echo $avatar_thumbnail; ?>" alt="" />
351
<?php _e('Thumbnail'); ?>
352
</p>
353
+ <p><button type="button" class="button<?php echo $hide_remove; ?>" id="wpua-remove" name="wpua-remove"><?php _e('Remove'); ?></button></p>
354
+ <p id="wpua-message"><?php printf(__('Click %s to save your changes', 'wp-user-avatar'), $profile); ?></p>
355
<?php if(class_exists('bbPress') && !is_admin()) : // Add to bbPress profile with same style ?>
356
</fieldset>
357
<?php else : // Add to profile with admin style ?>
449
// Add button to attach image for WP 3.4 and older
450
function wpua_add_attachment_field_to_edit($fields, $post){
451
$image = wp_get_attachment_image_src($post->ID, "medium");
452
+ $button = '<button type="button" class="button" id="set-wp-user-avatar-image" name="set-wp-user-avatar-image" onclick="setWPUserAvatar(\''.$post->ID.'\', \''.$image[0].'\')">'.__('Select Image').'</button>';
453
$fields['wp-user-avatar'] = array(
454
'label' => __('WP User Avatar', 'wp-user-avatar'),
455
'input' => 'html',
485
// Media uploader
486
function wpua_media_upload_scripts(){
487
global $pagenow;
488
wp_enqueue_script('jquery');
489
+ if(current_user_can('upload_files')){
490
+ if(function_exists('wp_enqueue_media')){
491
+ wp_enqueue_script('admin-bar');
492
+ wp_enqueue_media();
493
+ } else {
494
+ wp_enqueue_script('media-upload');
495
+ wp_enqueue_script('thickbox');
496
+ wp_enqueue_style('thickbox');
497
+ }
498
+ wp_enqueue_script('jquery-ui-slider');
499
+ }
500
+ wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', array('jquery'), WPUA_VERSION);
501
+ wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
502
if($pagenow == 'options-general.php'){
503
wp_enqueue_style('wp-user-avatar-jqueryui', WPUA_URLPATH.'css/jquery.ui.slider.css', "", null);
504
}
505
}
506
}
507
511
jQuery(function(){
512
<?php if(current_user_can('upload_files')) : ?>
513
<?php if(function_exists('wp_enqueue_media')) : // Backbone uploader for WP 3.5+ ?>
514
+ openMediaUploader('<?php echo $section; ?>', "<?php _e('Edit Image'); ?>", "<?php _e('Select Image'); ?>");
515
<?php else : // Fall back to Thickbox uploader ?>
516
openThickboxUploader('<?php echo $section; ?>', '<?php echo get_admin_url(); ?>media-upload.php?post_id=0&type=image&tab=library&TB_iframe=1');
517
<?php endif; ?>
808
$hide_remove = ' class="hide-me"';
809
}
810
// Default Avatar is wp_user_avatar, check the radio button next to it
811
+ $selected_avatar = ($avatar_default == 'wp_user_avatar' || (bool) $wpua_disable_gravatar == 1) ? ' checked="checked" ' : "";
812
// Wrap WPUA in div
813
+ $avatar_thumb_img = '<div id="wpua-preview"><img src="'.$avatar_thumb.'" width="32" /></div>';
814
// Add WPUA to list
815
$wpua_list = "\n\t<label><input type='radio' name='avatar_default' id='wp_user_avatar_radio' value='wp_user_avatar'$selected_avatar /> ";
816
$wpua_list .= preg_replace("/src='(.+?)'/", "src='\$1'", $avatar_thumb_img);
817
$wpua_list .= ' '.__('WP User Avatar', 'wp-user-avatar').'</label>';
818
+ $wpua_list .= '<p id="wpua-edit"><button type="button" class="button" id="wpua-add" name="wpua-add">'.__('Edit Image').'</button>';
819
+ $wpua_list .= '<a href="#" id="wpua-remove"'.$hide_remove.'>'.__('Remove').'</a></p>';
820
$wpua_list .= '<input type="hidden" id="wp-user-avatar" name="avatar_default_wp_user_avatar" value="'.$wpua_avatar_default.'">';
821
+ $wpua_list .= '<p id="wpua-message">'.sprintf(__('Click %s to save your changes', 'wp-user-avatar'), '&ldquo;'.__('Save Changes').'&rdquo;').'</p>';
822
$wpua_list .= wpua_js(__('Default Avatar'), $mustache_admin);
823
if($wpua_disable_gravatar != 1){
824
return $wpua_list.'<div id="wp-avatars">'.$avatar_list.'</div>';
870
871
// Admin page
872
function wpua_options_page(){
873
+ global $show_avatars, $upload_size_limit_with_units, $wpua_allow_upload, $wpua_disable_gravatar, $wpua_load_scripts, $wpua_tinymce, $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
874
// Give subscribers edit_posts capability
875
if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && empty($wpua_allow_upload)){
876
wpua_subscriber_remove_cap();
886
<?php do_settings_fields('wpua-settings-group', ""); ?>
887
<table class="form-table">
888
<tr valign="top">
889
+ <th scope="row"><?php _e('Settings'); ?></th>
890
<td>
891
<fieldset>
892
+ <legend class="screen-reader-text"><span><?php _e('Settings'); ?></span></legend>
893
<label for="wp_user_avatar_tinymce" class="wpua_label">
894
+ <input name="wp_user_avatar_tinymce" type="checkbox" id="wp_user_avatar_tinymce" value="1" <?php checked($wpua_tinymce, 1); ?> />
895
<?php _e('Add avatar button to Visual Editor', 'wp-user-avatar'); ?>
896
</label>
897
<label for="wp_user_avatar_allow_upload" class="wpua_label">
898
+ <input name="wp_user_avatar_allow_upload" type="checkbox" id="wp_user_avatar_allow_upload" value="1" <?php checked($wpua_allow_upload, 1); ?> />
899
+ <?php _e('Allow Contributors & Subscribers to upload avatars', 'wp-user-avatar'); ?>
900
</label>
901
<label for="wp_user_avatar_disable_gravatar" class="wpua_label">
902
+ <input name="wp_user_avatar_disable_gravatar" type="checkbox" id="wp_user_avatar_disable_gravatar" value="1" <?php checked($wpua_disable_gravatar, 1); ?> />
903
+ <?php _e('Disable Gravatar and use only local avatars', 'wp-user-avatar'); ?>
904
+ </label>
905
+ <label for="wp_user_avatar_load_scripts" class="wpua_label">
906
+ <input name="wp_user_avatar_load_scripts" type="checkbox" id="wp_user_avatar_load_scripts" value="1" <?php checked($wpua_load_scripts, 1); ?> />
907
+ <?php _e('Allow users to upload avatars in front pages', 'wp-user-avatar'); ?>
908
</label>
909
</fieldset>
910
</td>
911
</tr>
912
<tr id="wp-size-upload-limit-settings" valign="top"<?php echo $hide_size; ?>>
913
+ <th scope="row">
914
+ <label for="wp_user_avatar_upload_size_limit" class="wpua_label">
915
+ <?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?>
916
+ </label>
917
+ </th>
918
<td>
919
+ <fieldset>
920
+ <legend class="screen-reader-text"><span><?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?></span></legend>
921
+ <input name="wp_user_avatar_upload_size_limit" type="text" id="wp_user_avatar_upload_size_limit" value="<?php echo $wpua_upload_size_limit; ?>" class="regular-text" />
922
+ <span id="wpua-readable-size"><?php echo $wpua_upload_size_limit_with_units; ?></span>
923
+ <span id="wpua-readable-size-error"><?php printf(__('%s exceeds the maximum upload size for this site.'), ''); ?></span>
924
+ <div id="wpua-slider"></div>
925
+ <script type="text/javascript">
926
+ jQuery(function(){
927
+ // Show size info only if allow uploads is checked
928
+ jQuery('#wp_user_avatar_allow_upload').change(function(){
929
+ jQuery('#wp-size-upload-limit-settings').toggle(jQuery('#wp_user_avatar_allow_upload').is(':checked'));
930
+ });
931
+ // Hide Gravatars if disable Gravatars is checked
932
+ jQuery('#wp_user_avatar_disable_gravatar').change(function(){
933
+ if(jQuery('#wp-avatars').length){
934
+ jQuery('#wp-avatars').toggle(!jQuery('#wp_user_avatar_disable_gravatar').is(':checked'));
935
+ jQuery('#wp_user_avatar_radio').trigger('click');
936
+ }
937
+ jQuery('#wpua-message').show();
938
+ });
939
+ // Add size slider
940
+ jQuery('#wpua-slider').slider({
941
+ value: <?php echo $wpua_upload_size_limit; ?>,
942
+ min: 0,
943
+ max: <?php echo wp_max_upload_size(); ?>,
944
+ step: 1,
945
+ slide: function(event, ui){
946
+ jQuery('#wp_user_avatar_upload_size_limit').val(ui.value);
947
+ jQuery('#wpua-readable-size').html(Math.floor(ui.value / 1024) + 'KB');
948
+ jQuery('#wpua-readable-size-error').hide();
949
+ jQuery('#wpua-readable-size').removeClass('wpua-error');
950
+ }
951
+ });
952
+ // Update readable size on keyup
953
+ jQuery('#wp_user_avatar_upload_size_limit').keyup(function(){
954
+ var wpua_upload_size_limit = jQuery(this).val();
955
+ wpua_upload_size_limit = wpua_upload_size_limit.replace(/\D/g, '');
956
+ // jQuery(this).val(wpua_upload_size_limit);
957
+ jQuery('#wpua-readable-size').html(Math.floor(wpua_upload_size_limit / 1024) + 'KB');
958
+ jQuery('#wpua-readable-size-error').toggle(wpua_upload_size_limit > <?php echo wp_max_upload_size(); ?>);
959
+ jQuery('#wpua-readable-size').toggleClass('wpua-error', wpua_upload_size_limit > <?php echo wp_max_upload_size(); ?>);
960
+ });
961
+ jQuery('#wp_user_avatar_upload_size_limit').val(jQuery('#wpua-slider').slider('value'));
962
});
963
+ </script>
964
+ <span class="description"><?php printf(__('Maximum upload file size: %d%s.'), esc_html(wp_max_upload_size()), esc_html(' bytes ('.$upload_size_limit_with_units.')')); ?></span>
965
+ </fieldset>
966
</td>
967
</tr>
968
</table>
975
<fieldset>
976
<legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
977
<label for="show_avatars">
978
+ <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked($show_avatars, 1); ?> />
979
<?php _e('Show Avatars'); ?>
980
</label>
981
</fieldset>
1023
register_setting('wpua-settings-group', 'wp_user_avatar_tinymce', 'intval');
1024
register_setting('wpua-settings-group', 'wp_user_avatar_allow_upload', 'intval');
1025
register_setting('wpua-settings-group', 'wp_user_avatar_disable_gravatar', 'intval');
1026
+ register_setting('wpua-settings-group', 'wp_user_avatar_load_scripts', 'intval');
1027
register_setting('wpua-settings-group', 'wp_user_avatar_upload_size_limit', 'intval');
1028
register_setting('wpua-settings-group', 'show_avatars', 'intval');
1029
register_setting('wpua-settings-group', 'avatar_rating');
1033
1034
// Add options page and settings
1035
function wpua_admin(){
1036
+ add_options_page(__('WP User Avatar', 'wp-user-avatar'), __('WP User Avatar', 'wp-user-avatar'), 'manage_options', 'wp-user-avatar', 'wpua_options_page');
1037
add_action('admin_init', 'wpua_admin_settings');
1038
}
1039