Version Description
- Bug Fix: Files not committed properly in previous release
Download this release
Release Info
Developer | bangbay |
Plugin | WP User Avatar |
Version | 1.7.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.7.2
- css/wp-user-avatar.css +4 -3
- images/{wp-user-avatar-150x150.png → wpua-150x150.png} +0 -0
- images/{wp-user-avatar-300x300.png → wpua-300x300.png} +0 -0
- images/{wp-user-avatar-32x32.png → wpua-32x32.png} +0 -0
- images/{wp-user-avatar-96x96.png → wpua-96x96.png} +0 -0
- images/{wp-user-avatar.png → wpua.png} +0 -0
- includes/tinymce.php +1 -1
- includes/tinymce/editor_plugin.js +1 -1
- includes/tinymce/window.php +41 -29
- js/wp-user-avatar-admin.js +26 -21
- js/wp-user-avatar-user.js +30 -0
- js/wp-user-avatar.js +1 -1
- lang/wp-user-avatar-de_DE.mo +0 -0
- lang/wp-user-avatar-de_DE.po +38 -13
- lang/wp-user-avatar-es_ES.mo +0 -0
- lang/wp-user-avatar-es_ES.po +38 -13
- lang/wp-user-avatar-fr_FR.mo +0 -0
- lang/wp-user-avatar-fr_FR.po +38 -13
- lang/wp-user-avatar-pl_PL.mo +0 -0
- lang/wp-user-avatar-pl_PL.po +86 -0
- lang/wp-user-avatar-sv_SE.mo +0 -0
- lang/wp-user-avatar-sv_SE.po +38 -13
- readme.txt +227 -27
- uninstall.php +9 -1
- wp-user-avatar.php +364 -206
css/wp-user-avatar.css
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
#wpua-errors, #wpua-message, #wpua-readable-size-error, .wpua-error { color: #c00 !important; font-weight: 700 !important; }
|
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 !important; }
|
5 |
#wpua-preview img, #wpua-thumbnail img { max-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 !important; }
|
9 |
-
#wpua-edit #wpua-remove { margin-left: 10px !important; }
|
10 |
#wpua-slider { width: 22.75em; }
|
|
|
11 |
.wpua-hide { display: none !important; }
|
1 |
#wpua-errors, #wpua-message, #wpua-readable-size-error, .wpua-error { color: #c00 !important; font-weight: 700 !important; }
|
2 |
+
#wpua-message, #wpua-readable-size-error, #wpua-undo-button { display: none; }
|
3 |
+
#wpua-preview { margin-right: 10px; }
|
4 |
#wpua-preview, #wpua-thumbnail { display: inline-block; text-align: center; vertical-align: top; }
|
|
|
5 |
#wpua-preview img, #wpua-thumbnail img { max-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 !important; }
|
9 |
+
#wpua-edit #wpua-remove, #wpua-edit #wpua-undo { margin-left: 10px !important; }
|
10 |
#wpua-slider { width: 22.75em; }
|
11 |
+
#wpua-upload-messages span { display: block; }
|
12 |
.wpua-hide { display: none !important; }
|
images/{wp-user-avatar-150x150.png → wpua-150x150.png}
RENAMED
File without changes
|
images/{wp-user-avatar-300x300.png → wpua-300x300.png}
RENAMED
File without changes
|
images/{wp-user-avatar-32x32.png → wpua-32x32.png}
RENAMED
File without changes
|
images/{wp-user-avatar-96x96.png → wpua-96x96.png}
RENAMED
File without changes
|
images/{wp-user-avatar.png → wpua.png}
RENAMED
File without changes
|
includes/tinymce.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
-
* @version 1.
|
5 |
*/
|
6 |
|
7 |
if(!defined('ABSPATH')){
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
+
* @version 1.7.2
|
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:
|
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:330,inline:1},{plugin_url:url})});ed.addButton('wpUserAvatar',{title:'Insert WP User Avatar',cmd:'mceWpUserAvatar',image:url+'/../../images/wpua-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.7.2"}}});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 |
*/
|
6 |
|
7 |
if(!defined('ABSPATH')){
|
@@ -18,9 +18,9 @@ if(!defined('ABSPATH')){
|
|
18 |
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
19 |
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
<script type="text/javascript">
|
21 |
-
function
|
22 |
// Custom shortcode values
|
23 |
-
var shortcode;
|
24 |
var user = document.getElementById('wp_user_avatar_user').value;
|
25 |
var size = document.getElementById('wp_user_avatar_size').value;
|
26 |
var size_number = document.getElementById('wp_user_avatar_size_number').value;
|
@@ -28,17 +28,20 @@ if(!defined('ABSPATH')){
|
|
28 |
var link = document.getElementById('wp_user_avatar_link').value;
|
29 |
var link_external = document.getElementById('wp_user_avatar_link_external').value;
|
30 |
var target = document.getElementById('wp_user_avatar_target').value;
|
|
|
31 |
|
32 |
// Add tag to shortcode only if not blank
|
33 |
var user_tag = (user != "") ? ' user="' + user + '"' : "";
|
34 |
var size_tag = (size != "" && size_number == "") ? ' size="' + size + '"' : "";
|
35 |
-
|
36 |
var align_tag = (align != "") ? ' align="' + align + '"' : "";
|
37 |
var link_tag = (link != "" && link != 'custom-url' && link_external == "") ? ' link="' + link + '"' : "";
|
38 |
-
|
39 |
var target_tag = document.getElementById('wp_user_avatar_target').checked && (link_tag != "") ? ' target="' + target + '"' : "";
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
|
43 |
if(window.tinyMCE){
|
44 |
window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, shortcode);
|
@@ -47,12 +50,12 @@ if(!defined('ABSPATH')){
|
|
47 |
}
|
48 |
return;
|
49 |
}
|
50 |
-
jQuery(function(){
|
51 |
-
|
52 |
-
|
53 |
});
|
54 |
-
|
55 |
-
|
56 |
});
|
57 |
});
|
58 |
</script>
|
@@ -60,21 +63,23 @@ if(!defined('ABSPATH')){
|
|
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=
|
70 |
<form name="wpUserAvatar" action="#">
|
71 |
-
<p
|
72 |
-
|
73 |
-
<
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
78 |
|
79 |
<p>
|
80 |
<label for="<?php esc_attr_e('wp_user_avatar_size'); ?>"><strong><?php _e('Size'); ?>:</strong></label>
|
@@ -93,13 +98,15 @@ if(!defined('ABSPATH')){
|
|
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 |
|
96 |
-
<p
|
97 |
-
|
98 |
-
<
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
103 |
|
104 |
<p>
|
105 |
<label for="<?php esc_attr_e('wp_user_avatar_link'); ?>"><strong><?php _e('Link To'); ?>:</strong></label>
|
@@ -121,8 +128,13 @@ if(!defined('ABSPATH')){
|
|
121 |
<input type="checkbox" id="<?php esc_attr_e('wp_user_avatar_target'); ?>" name="<?php esc_attr_e('wp_user_avatar_target'); ?>" value="_blank" /> <strong><?php _e('Open link in a new window'); ?></strong>
|
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="
|
126 |
</div>
|
127 |
</form>
|
128 |
</body>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
+
* @version 1.7.2
|
5 |
*/
|
6 |
|
7 |
if(!defined('ABSPATH')){
|
18 |
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
|
19 |
<script type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
|
20 |
<script type="text/javascript">
|
21 |
+
function wpuaInsertAvatar(){
|
22 |
// Custom shortcode values
|
23 |
+
var shortcode, closing_tag;
|
24 |
var user = document.getElementById('wp_user_avatar_user').value;
|
25 |
var size = document.getElementById('wp_user_avatar_size').value;
|
26 |
var size_number = document.getElementById('wp_user_avatar_size_number').value;
|
28 |
var link = document.getElementById('wp_user_avatar_link').value;
|
29 |
var link_external = document.getElementById('wp_user_avatar_link_external').value;
|
30 |
var target = document.getElementById('wp_user_avatar_target').value;
|
31 |
+
var caption = document.getElementById('wp_user_avatar_caption').value;
|
32 |
|
33 |
// Add tag to shortcode only if not blank
|
34 |
var user_tag = (user != "") ? ' user="' + user + '"' : "";
|
35 |
var size_tag = (size != "" && size_number == "") ? ' size="' + size + '"' : "";
|
36 |
+
size_tag = (size_number != "") ? ' size="' + size_number + '"' : size_tag;
|
37 |
var align_tag = (align != "") ? ' align="' + align + '"' : "";
|
38 |
var link_tag = (link != "" && link != 'custom-url' && link_external == "") ? ' link="' + link + '"' : "";
|
39 |
+
link_tag = (link_external != "") ? ' link="' + link_external + '"' : link_tag;
|
40 |
var target_tag = document.getElementById('wp_user_avatar_target').checked && (link_tag != "") ? ' target="' + target + '"' : "";
|
41 |
+
|
42 |
+
// Assemble the shortcode
|
43 |
+
closing_tag = (caption != "") ? "]" + caption + "[/avatar]" : " /]";
|
44 |
+
shortcode = "<p>[avatar" + user_tag + size_tag + align_tag + link_tag + target_tag + closing_tag + "</p>";
|
45 |
|
46 |
if(window.tinyMCE){
|
47 |
window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, shortcode);
|
50 |
}
|
51 |
return;
|
52 |
}
|
53 |
+
jQuery(function($){
|
54 |
+
$('#wp_user_avatar_link').change(function(){
|
55 |
+
$('#wp_user_avatar_link_external_section').toggle($('#wp_user_avatar_link').val() == 'custom-url');
|
56 |
});
|
57 |
+
$('#wp_user_avatar_size').change(function(){
|
58 |
+
$('#wp_user_avatar_size_number_section').toggle($('#wp_user_avatar_size').val() == 'custom');
|
59 |
});
|
60 |
});
|
61 |
</script>
|
63 |
form { background: #fff; border: 1px solid #eee; }
|
64 |
p, h4 { margin: 0; padding: 12px 0 0; }
|
65 |
h4.center { text-align: center; }
|
66 |
+
label { width: 150px; margin-right: 3px; display: inline-block; text-align: right; vertical-align: top; }
|
67 |
.mceActionPanel { padding: 7px 0 12px; text-align: center; }
|
68 |
.mceActionPanel #insert { float: none; width: 180px; margin: 0 auto; }
|
69 |
#wp_user_avatar_size_number_section, #wp_user_avatar_link_external_section { display: none; }
|
70 |
</style>
|
71 |
</head>
|
72 |
+
<body id="link" class="wp-core-ui" onload="document.body.style.display='';" style="display:none;">
|
73 |
<form name="wpUserAvatar" action="#">
|
74 |
+
<p>
|
75 |
+
<label for="<?php esc_attr_e('wp_user_avatar_user'); ?>"><strong><?php _e('User Name'); ?>:</strong></label>
|
76 |
+
<select id="<?php esc_attr_e('wp_user_avatar_user'); ?>" name="<?php esc_attr_e('wp_user_avatar_user'); ?>">
|
77 |
+
<option value=""></option>
|
78 |
+
<?php $users = get_users(); foreach($users as $user) : ?>
|
79 |
+
<option value="<?php echo $user->user_login; ?>"><?php echo $user->display_name; ?></option>
|
80 |
+
<?php endforeach; ?>
|
81 |
+
</select>
|
82 |
+
</p>
|
83 |
|
84 |
<p>
|
85 |
<label for="<?php esc_attr_e('wp_user_avatar_size'); ?>"><strong><?php _e('Size'); ?>:</strong></label>
|
98 |
<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="" />
|
99 |
</p>
|
100 |
|
101 |
+
<p>
|
102 |
+
<label for="<?php esc_attr_e('wp_user_avatar_align'); ?>"><strong><?php _e('Alignment'); ?>:</strong></label>
|
103 |
+
<select id="<?php esc_attr_e('wp_user_avatar_align'); ?>" name="<?php esc_attr_e('wp_user_avatar_align'); ?>">
|
104 |
+
<option value=""></option>
|
105 |
+
<option value="center"><?php _e('Center'); ?></option>
|
106 |
+
<option value="left"><?php _e('Left'); ?></option>
|
107 |
+
<option value="right"><?php _e('Right'); ?></option>
|
108 |
+
</select>
|
109 |
+
</p>
|
110 |
|
111 |
<p>
|
112 |
<label for="<?php esc_attr_e('wp_user_avatar_link'); ?>"><strong><?php _e('Link To'); ?>:</strong></label>
|
128 |
<input type="checkbox" id="<?php esc_attr_e('wp_user_avatar_target'); ?>" name="<?php esc_attr_e('wp_user_avatar_target'); ?>" value="_blank" /> <strong><?php _e('Open link in a new window'); ?></strong>
|
129 |
</p>
|
130 |
|
131 |
+
<p>
|
132 |
+
<label for="<?php esc_attr_e('wp_user_avatar_caption'); ?>"><strong><?php _e('Caption'); ?></strong></label>
|
133 |
+
<textarea cols="36" rows="2" id="<?php esc_attr_e('wp_user_avatar_caption'); ?>" name="<?php esc_attr_e('wp_user_avatar_size'); ?>"></textarea>
|
134 |
+
</p>
|
135 |
+
|
136 |
<div class="mceActionPanel">
|
137 |
+
<input type="submit" id="insert" class="button-primary" name="insert" value="<?php _e('Insert into Post'); ?>" onclick="wpuaInsertAvatar();" />
|
138 |
</div>
|
139 |
</form>
|
140 |
</body>
|
js/wp-user-avatar-admin.js
CHANGED
@@ -1,37 +1,42 @@
|
|
1 |
-
jQuery(function(){
|
2 |
// Show size info only if allow uploads is checked
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
});
|
6 |
// Hide Gravatars if disable Gravatars is checked
|
7 |
-
|
8 |
-
if(
|
9 |
-
|
10 |
-
|
|
|
|
|
11 |
}
|
12 |
-
jQuery('#wpua-message').show();
|
13 |
});
|
14 |
// Add size slider
|
15 |
-
|
16 |
value: parseInt(wpua_admin.upload_size_limit),
|
17 |
min: 0,
|
18 |
max: parseInt(wpua_admin.max_upload_size),
|
19 |
step: 1,
|
20 |
slide: function(event, ui){
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
});
|
27 |
// Update readable size on keyup
|
28 |
-
|
29 |
-
var
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
});
|
36 |
-
|
37 |
});
|
1 |
+
jQuery(function($){
|
2 |
// Show size info only if allow uploads is checked
|
3 |
+
$('#wp_user_avatar_allow_upload').change(function(){
|
4 |
+
$('#wpua-contributors-subscribers').slideToggle($('#wp_user_avatar_allow_upload').is(':checked'));
|
5 |
+
});
|
6 |
+
// Show resize info only if resize uploads is checked
|
7 |
+
$('#wp_user_avatar_resize_upload').change(function(){
|
8 |
+
$('#wpua-resize-sizes').slideToggle($('#wp_user_avatar_resize_upload').is(':checked'));
|
9 |
});
|
10 |
// Hide Gravatars if disable Gravatars is checked
|
11 |
+
$('#wp_user_avatar_disable_gravatar').change(function(){
|
12 |
+
if($('#wp-avatars').length){
|
13 |
+
$('#wp-avatars').slideToggle(!$('#wp_user_avatar_disable_gravatar').is(':checked'));
|
14 |
+
$('#wp_user_avatar_radio').trigger('click');
|
15 |
+
} else {
|
16 |
+
$('#wpua-message').show();
|
17 |
}
|
|
|
18 |
});
|
19 |
// Add size slider
|
20 |
+
$('#wpua-slider').slider({
|
21 |
value: parseInt(wpua_admin.upload_size_limit),
|
22 |
min: 0,
|
23 |
max: parseInt(wpua_admin.max_upload_size),
|
24 |
step: 1,
|
25 |
slide: function(event, ui){
|
26 |
+
$('#wp_user_avatar_upload_size_limit').val(ui.value);
|
27 |
+
$('#wpua-readable-size').html(Math.floor(ui.value / 1024) + 'KB');
|
28 |
+
$('#wpua-readable-size-error').hide();
|
29 |
+
$('#wpua-readable-size').removeClass('wpua-error');
|
30 |
}
|
31 |
});
|
32 |
// Update readable size on keyup
|
33 |
+
$('#wp_user_avatar_upload_size_limit').keyup(function(){
|
34 |
+
var wpuaUploadSizeLimit = $(this).val();
|
35 |
+
wpuaUploadSizeLimit = wpuaUploadSizeLimit.replace(/\D/g, '');
|
36 |
+
$(this).val(wpuaUploadSizeLimit);
|
37 |
+
$('#wpua-readable-size').html(Math.floor(wpuaUploadSizeLimit / 1024) + 'KB');
|
38 |
+
$('#wpua-readable-size-error').toggle(wpuaUploadSizeLimit > parseInt(wpua_admin.max_upload_size));
|
39 |
+
$('#wpua-readable-size').toggleClass('wpua-error', wpuaUploadSizeLimit > parseInt(wpua_admin.max_upload_size));
|
40 |
});
|
41 |
+
$('#wp_user_avatar_upload_size_limit').val($('#wpua-slider').slider('value'));
|
42 |
});
|
js/wp-user-avatar-user.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function($){
|
2 |
+
// Add enctype to form with JavaScript as backup
|
3 |
+
$('#your-profile').attr('enctype', 'multipart/form-data');
|
4 |
+
// Store WP User Avatar ID
|
5 |
+
var wpuaID = $('#wp-user-avatar').val();
|
6 |
+
// Store WP User Avatar src
|
7 |
+
var wpuaSrc = $('#wpua-preview').find('img').attr('src');
|
8 |
+
// Remove WP User Avatar
|
9 |
+
$('body').on('click', '#wpua-remove', function(e){
|
10 |
+
e.preventDefault();
|
11 |
+
$('#wpua-original').remove();
|
12 |
+
$('#wpua-remove-button, #wpua-thumbnail').hide();
|
13 |
+
$('#wpua-preview').find('img:first').hide();
|
14 |
+
$('#wpua-preview').prepend('<img id="wpua-original" height="98" />');
|
15 |
+
$('#wpua-original').attr('src', wpua_custom.avatar_thumb);
|
16 |
+
$('#wp-user-avatar').val("");
|
17 |
+
$('#wpua-message, #wpua-original, #wpua-undo-button').show();
|
18 |
+
$('#wp_user_avatar_radio').trigger('click');
|
19 |
+
});
|
20 |
+
// Undo WP User Avatar
|
21 |
+
$('body').on('click', '#wpua-undo', function(e){
|
22 |
+
e.preventDefault();
|
23 |
+
$('#wpua-original').remove();
|
24 |
+
$('#wpua-message, #wpua-undo-button').hide();
|
25 |
+
$('#wpua-remove-button, #wpua-thumbnail').show();
|
26 |
+
$('#wpua-preview').find('img:first').attr('src', wpuaSrc).show();
|
27 |
+
$('#wp-user-avatar').val(wpuaID);
|
28 |
+
$('#wp_user_avatar_radio').trigger('click');
|
29 |
+
});
|
30 |
+
});
|
js/wp-user-avatar.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function
|
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}('4 V(c,d,f){2.6.y={S:4(){T 2.6.G.N.8.C},W:4(a){x b=2.6.G.N;b.8.C=a;b.8.P=5(\'1n.o-1a\').A(\'m\').k(\'r\');O(b.8.C&&b.8.P){5(\'#2-s-t\',g.9.h).v(b.8.C);5(\'#0-w\',g.9.h).A(\'m\').k(\'r\',b.8.P).1c(\'10\',"");5(\'#0-L\',g.9.h).p();5(\'#0-B-n\',g.9.h).p();5(\'#0-l-n\',g.9.h).z();5(\'#0-H\',g.9.h).z();5(\'#I\',g.9.h).J(\'i\')}2.6.y.K().1d()},K:4(){O(3.7){T 3.7}3.7=2.6({M:\'11\',1r:[13 2.6.16.12({1b:d+": "+c})]});3.7.j(\'U\',4(){x a=3.M().S(\'u\');D=5(\'#2-s-t\').v();o=2.6.o(D);o.1s();a.X(o?[o]:[])},3.7);3.7.j(\'14:15:E\',4(a){3.17(a,{18:f})},3.7);3.7.M(\'11\').j(\'E\',3.E);T 3.7},E:4(a){x b=2.6.G.N,u=3.S(\'u\').19();2.6.y.W(u?u.D:-1)},Z:4(){5(\'Q\').j(\'i\',\'#0-X\',4(e){e.R();e.1e();2.6.y.K().U()})}};5(2.6.y.Z)}5(4($){$(\'#1f-1g\').k(\'1h\',\'1i/1j-1k\');O(1l(2)!=\'1m\'){V(F.1o,F.1p,F.1q)}x a=$(\'#2-s-t\').v();x b=$(\'#0-w\').A(\'m\').k(\'r\');$(\'Q\').j(\'i\',\'#0-l\',4(e){e.R();$(\'#0-q\').l();$(\'#0-l-n, #0-H\').z();$(\'#0-w\').A(\'m:Y\').z();$(\'#0-w\').1t(\'<m D="0-q" 10="1u" />\');$(\'#0-q\').k(\'r\',F.1v);$(\'#2-s-t\').v("");$(\'#0-L, #0-q, #0-B-n\').p();$(\'#I\').J(\'i\')});$(\'Q\').j(\'i\',\'#0-B\',4(e){e.R();$(\'#0-q\').l();$(\'#0-L, #0-B-n\').z();$(\'#0-l-n, #0-H\').p();$(\'#0-w\').A(\'m:Y\').k(\'r\',b).p();$(\'#2-s-t\').v(a);$(\'#I\').J(\'i\')})});',62,94,'wpua||wp|this|function|jQuery|media|_frame|post|parent|||||||window|document|click|on|attr|remove|img|button|attachment|show|original|src|user|avatar|selection|val|preview|var|wpUserAvatar|hide|find|undo|wpUserAvatarId|id|select|wpua_custom|view|thumbnail|wp_user_avatar_radio|trigger|frame|message|state|settings|if|wpUserAvatarSrc|body|preventDefault|get|return|open|wpuaMediaUploader|set|add|first|init|height|library|Library|new|toolbar|create|controller|createSelectToolbar|text|single|info|title|removeAttr|close|stopPropagation|your|profile|enctype|multipart|form|data|typeof|undefined|div|section|edit_image|select_image|states|fetch|prepend|98|avatar_thumb'.split('|'),0,{}))
|
lang/wp-user-avatar-de_DE.mo
CHANGED
Binary file
|
lang/wp-user-avatar-de_DE.po
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# German (de_DE) translation for WP User Avatar.
|
2 |
-
# Copyright (C)
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
-
"Project-Id-Version: WP User Avatar 1.
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
-
"PO-Revision-Date:
|
10 |
"Language: de_DE\n"
|
11 |
"Last-Translator: WP User Avatar\n"
|
12 |
"Language-Team: WP User Avatar\n"
|
@@ -14,32 +14,57 @@ msgstr ""
|
|
14 |
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
|
17 |
-
#: wp-user-avatar.php:
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
msgid "Click %s to save your changes"
|
20 |
msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
|
21 |
|
22 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
23 |
msgid "Add avatar button to Visual Editor"
|
24 |
msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
|
25 |
|
26 |
-
#: wp-user-avatar.php:
|
27 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
28 |
msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
|
29 |
|
30 |
-
#: wp-user-avatar.php:
|
31 |
msgid "Disable Gravatar and use only local avatars"
|
32 |
msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
|
33 |
|
34 |
-
#: wp-user-avatar.php:
|
35 |
-
#: wp-user-avatar.php:
|
36 |
-
msgid "Upload Size Limit
|
37 |
-
msgstr "Dateigrößenbeschränkung
|
38 |
|
39 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
|
|
40 |
msgid "Allow users to edit avatars"
|
41 |
msgstr "Benutzer erlauben, Avatare bearbeiten"
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
#. Plugin Name of the plugin/theme
|
44 |
msgid "WP User Avatar"
|
45 |
msgstr "WP-Benutzer-Avatar"
|
1 |
# German (de_DE) translation for WP User Avatar.
|
2 |
+
# Copyright (C) 2014 Bangbay Siboliban.
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
+
"Project-Id-Version: WP User Avatar 1.7.2\n"
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
+
"PO-Revision-Date: 2014-01-16 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:318
|
18 |
+
msgid "Do you like WP User Avatar?"
|
19 |
+
msgstr "Bist Du mit WP-Benutzer-Avatar zufrieden?"
|
20 |
+
|
21 |
+
#: wp-user-avatar.php:318
|
22 |
+
msgid "Make a donation."
|
23 |
+
msgstr "Spenden"
|
24 |
+
|
25 |
+
#: wp-user-avatar.php:411
|
26 |
+
#: wp-user-avatar.php:925
|
27 |
msgid "Click %s to save your changes"
|
28 |
msgstr "Klicken Sie %s, um Ihre Änderungen zu speichern"
|
29 |
|
30 |
+
#: wp-user-avatar.php:536
|
31 |
+
msgid "Donate"
|
32 |
+
msgstr "Spenden"
|
33 |
+
|
34 |
+
#: wp-user-avatar.php:999
|
35 |
msgid "Add avatar button to Visual Editor"
|
36 |
msgstr "Einen Avatar-Knopf zum WYSIWYG-Editor hinzufügen"
|
37 |
|
38 |
+
#: wp-user-avatar.php:1005
|
39 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
40 |
msgstr "Mitarbeiter und Abonnenten erlauben, Avatare hochzuladen"
|
41 |
|
42 |
+
#: wp-user-avatar.php:1011
|
43 |
msgid "Disable Gravatar and use only local avatars"
|
44 |
msgstr "Gravatar deaktivieren und nur lokale Avatare verwenden"
|
45 |
|
46 |
+
#: wp-user-avatar.php:1022
|
47 |
+
#: wp-user-avatar.php:1027
|
48 |
+
msgid "Upload Size Limit"
|
49 |
+
msgstr "Dateigrößenbeschränkung"
|
50 |
|
51 |
+
#: wp-user-avatar.php:1022
|
52 |
+
#: wp-user-avatar.php:1027
|
53 |
+
msgid "(only for Contributors & Subscribers)"
|
54 |
+
msgstr "(nur für Mitarbeiter und Abonnenten)"
|
55 |
+
|
56 |
+
#: wp-user-avatar.php:1037
|
57 |
msgid "Allow users to edit avatars"
|
58 |
msgstr "Benutzer erlauben, Avatare bearbeiten"
|
59 |
|
60 |
+
#: wp-user-avatar.php:1043
|
61 |
+
msgid "Resize avatars on upload"
|
62 |
+
msgstr "Resize Avatare beim Upload"
|
63 |
+
|
64 |
+
#: wp-user-avatar.php:1055
|
65 |
+
msgid "Crop avatars to exact dimensions"
|
66 |
+
msgstr "Avatare auf exakte Größe beschneiden"
|
67 |
+
|
68 |
#. Plugin Name of the plugin/theme
|
69 |
msgid "WP User Avatar"
|
70 |
msgstr "WP-Benutzer-Avatar"
|
lang/wp-user-avatar-es_ES.mo
CHANGED
Binary file
|
lang/wp-user-avatar-es_ES.po
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# Spanish (es_ES) translation for WP User Avatar.
|
2 |
-
# Copyright (C)
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
-
"Project-Id-Version: WP User Avatar 1.
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
-
"PO-Revision-Date:
|
10 |
"Language: es_ES\n"
|
11 |
"Last-Translator: WP User Avatar\n"
|
12 |
"Language-Team: WP User Avatar\n"
|
@@ -14,32 +14,57 @@ msgstr ""
|
|
14 |
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
|
17 |
-
#: wp-user-avatar.php:
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
msgid "Click %s to save your changes"
|
20 |
msgstr "Haz clic %s para guardar los cambios"
|
21 |
|
22 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
23 |
msgid "Add avatar button to Visual Editor"
|
24 |
msgstr "Añadir botón avatar al editor visual"
|
25 |
|
26 |
-
#: wp-user-avatar.php:
|
27 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
28 |
msgstr "Permitir los colaboradores y los suscriptores subir avatares"
|
29 |
|
30 |
-
#: wp-user-avatar.php:
|
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:
|
35 |
-
#: wp-user-avatar.php:
|
36 |
-
msgid "Upload Size Limit
|
37 |
-
msgstr "Sube límite de tamaño
|
38 |
|
39 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
|
|
40 |
msgid "Allow users to edit avatars"
|
41 |
msgstr "Permitir a los usuarios editar avatar"
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
#. Plugin Name of the plugin/theme
|
44 |
msgid "WP User Avatar"
|
45 |
msgstr "WP-Usuario-Avatar"
|
1 |
# Spanish (es_ES) translation for WP User Avatar.
|
2 |
+
# Copyright (C) 2014 Bangbay Siboliban.
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
+
"Project-Id-Version: WP User Avatar 1.7.2\n"
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
+
"PO-Revision-Date: 2014-01-16 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:318
|
18 |
+
msgid "Do you like WP User Avatar?"
|
19 |
+
msgstr "¿Está satisfecho con WP-Usuario-Avatar?"
|
20 |
+
|
21 |
+
#: wp-user-avatar.php:318
|
22 |
+
msgid "Make a donation."
|
23 |
+
msgstr "Donar"
|
24 |
+
|
25 |
+
#: wp-user-avatar.php:411
|
26 |
+
#: wp-user-avatar.php:925
|
27 |
msgid "Click %s to save your changes"
|
28 |
msgstr "Haz clic %s para guardar los cambios"
|
29 |
|
30 |
+
#: wp-user-avatar.php:536
|
31 |
+
msgid "Donate"
|
32 |
+
msgstr "Donar"
|
33 |
+
|
34 |
+
#: wp-user-avatar.php:999
|
35 |
msgid "Add avatar button to Visual Editor"
|
36 |
msgstr "Añadir botón avatar al editor visual"
|
37 |
|
38 |
+
#: wp-user-avatar.php:1005
|
39 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
40 |
msgstr "Permitir los colaboradores y los suscriptores subir avatares"
|
41 |
|
42 |
+
#: wp-user-avatar.php:1011
|
43 |
msgid "Disable Gravatar and use only local avatars"
|
44 |
msgstr "Desactivar Gravatar y utilizar sólo los avatares locales"
|
45 |
|
46 |
+
#: wp-user-avatar.php:1022
|
47 |
+
#: wp-user-avatar.php:1027
|
48 |
+
msgid "Upload Size Limit"
|
49 |
+
msgstr "Sube límite de tamaño"
|
50 |
|
51 |
+
#: wp-user-avatar.php:1022
|
52 |
+
#: wp-user-avatar.php:1027
|
53 |
+
msgid "(only for Contributors & Subscribers)"
|
54 |
+
msgstr "(para colaboradores y suscriptores)"
|
55 |
+
|
56 |
+
#: wp-user-avatar.php:1037
|
57 |
msgid "Allow users to edit avatars"
|
58 |
msgstr "Permitir a los usuarios editar avatar"
|
59 |
|
60 |
+
#: wp-user-avatar.php:1043
|
61 |
+
msgid "Resize avatars on upload"
|
62 |
+
msgstr "Cambiar el tamaño de avatares en carga"
|
63 |
+
|
64 |
+
#: wp-user-avatar.php:1055
|
65 |
+
msgid "Crop avatars to exact dimensions"
|
66 |
+
msgstr "Recortar los avatares a sus dimensiones exactas"
|
67 |
+
|
68 |
#. Plugin Name of the plugin/theme
|
69 |
msgid "WP User Avatar"
|
70 |
msgstr "WP-Usuario-Avatar"
|
lang/wp-user-avatar-fr_FR.mo
CHANGED
Binary file
|
lang/wp-user-avatar-fr_FR.po
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# French (fr_FR) translation for WP User Avatar.
|
2 |
-
# Copyright (C)
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
-
"Project-Id-Version: WP User Avatar 1.
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
-
"PO-Revision-Date:
|
10 |
"Language: fr_FR\n"
|
11 |
"Last-Translator: WP User Avatar\n"
|
12 |
"Language-Team: WP User Avatar\n"
|
@@ -14,32 +14,57 @@ msgstr ""
|
|
14 |
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
|
17 |
-
#: wp-user-avatar.php:
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
msgid "Click %s to save your changes"
|
20 |
msgstr "Cliquez sur %s pour enregistrer vos modifications"
|
21 |
|
22 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
23 |
msgid "Add avatar button to Visual Editor"
|
24 |
msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
|
25 |
|
26 |
-
#: wp-user-avatar.php:
|
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:
|
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:
|
35 |
-
#: wp-user-avatar.php:
|
36 |
-
msgid "Upload Size Limit
|
37 |
-
msgstr "Taille limite d'envoi de fichiers
|
38 |
|
39 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
|
|
40 |
msgid "Allow users to edit avatars"
|
41 |
msgstr "Permettre aux utilisateurs de modifier avatar"
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
#. Plugin Name of the plugin/theme
|
44 |
msgid "WP User Avatar"
|
45 |
msgstr "WP-Utilisateur-Avatar"
|
1 |
# French (fr_FR) translation for WP User Avatar.
|
2 |
+
# Copyright (C) 2014 Bangbay Siboliban.
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
+
"Project-Id-Version: WP User Avatar 1.7.2\n"
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
+
"PO-Revision-Date: 2014-01-16 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:318
|
18 |
+
msgid "Do you like WP User Avatar?"
|
19 |
+
msgstr "Etes-vous satisfait avec WP-Utilisateur-Avatar?"
|
20 |
+
|
21 |
+
#: wp-user-avatar.php:318
|
22 |
+
msgid "Make a donation."
|
23 |
+
msgstr "Faites un don"
|
24 |
+
|
25 |
+
#: wp-user-avatar.php:411
|
26 |
+
#: wp-user-avatar.php:925
|
27 |
msgid "Click %s to save your changes"
|
28 |
msgstr "Cliquez sur %s pour enregistrer vos modifications"
|
29 |
|
30 |
+
#: wp-user-avatar.php:536
|
31 |
+
msgid "Donate"
|
32 |
+
msgstr "Faites un don"
|
33 |
+
|
34 |
+
#: wp-user-avatar.php:999
|
35 |
msgid "Add avatar button to Visual Editor"
|
36 |
msgstr "Ajouter le bouton avatar sur l'éditeur visuel"
|
37 |
|
38 |
+
#: wp-user-avatar.php:1005
|
39 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
40 |
msgstr "Permettre aux contributeurs et aux abonnés d'envoyer des avatars"
|
41 |
|
42 |
+
#: wp-user-avatar.php:1011
|
43 |
msgid "Disable Gravatar and use only local avatars"
|
44 |
msgstr "Désactiver Gravatar et utiliser les avatars fournis"
|
45 |
|
46 |
+
#: wp-user-avatar.php:1022
|
47 |
+
#: wp-user-avatar.php:1027
|
48 |
+
msgid "Upload Size Limit"
|
49 |
+
msgstr "Taille limite d'envoi de fichiers"
|
50 |
|
51 |
+
#: wp-user-avatar.php:1022
|
52 |
+
#: wp-user-avatar.php:1027
|
53 |
+
msgid "(only for Contributors & Subscribers)"
|
54 |
+
msgstr "(pour contributeurs et abonnés)"
|
55 |
+
|
56 |
+
#: wp-user-avatar.php:1037
|
57 |
msgid "Allow users to edit avatars"
|
58 |
msgstr "Permettre aux utilisateurs de modifier avatar"
|
59 |
|
60 |
+
#: wp-user-avatar.php:1043
|
61 |
+
msgid "Resize avatars on upload"
|
62 |
+
msgstr "Redimensionner avatars lors du téléchargement"
|
63 |
+
|
64 |
+
#: wp-user-avatar.php:1037
|
65 |
+
msgid "Crop avatars to exact dimensions"
|
66 |
+
msgstr "Recadrer les avatars pour parvenir aux dimensions exactes"
|
67 |
+
|
68 |
#. Plugin Name of the plugin/theme
|
69 |
msgid "WP User Avatar"
|
70 |
msgstr "WP-Utilisateur-Avatar"
|
lang/wp-user-avatar-pl_PL.mo
ADDED
Binary file
|
lang/wp-user-avatar-pl_PL.po
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Polish (pl_PL) translation for WP User Avatar.
|
2 |
+
# Copyright (C) 2014 Bangbay Siboliban.
|
3 |
+
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
+
#
|
5 |
+
msgid ""
|
6 |
+
msgstr ""
|
7 |
+
"Project-Id-Version: WP User Avatar 1.7.2\n"
|
8 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
+
"PO-Revision-Date: 2014-01-16 00:00-0000\n"
|
10 |
+
"Language: de_DE\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:318
|
18 |
+
msgid "Do you like WP User Avatar?"
|
19 |
+
msgstr "Jesteś zadowolony z Wp User Avatar"
|
20 |
+
|
21 |
+
#: wp-user-avatar.php:318
|
22 |
+
msgid "Make a donation."
|
23 |
+
msgstr "Dokonaj dotacji"
|
24 |
+
|
25 |
+
#: wp-user-avatar.php:411
|
26 |
+
#: wp-user-avatar.php:925
|
27 |
+
msgid "Click %s to save your changes"
|
28 |
+
msgstr "Kliknij %s, by zachować ustawienia"
|
29 |
+
|
30 |
+
#: wp-user-avatar.php:536
|
31 |
+
msgid "Donate"
|
32 |
+
msgstr "Dotuj"
|
33 |
+
|
34 |
+
#: wp-user-avatar.php:999
|
35 |
+
msgid "Add avatar button to Visual Editor"
|
36 |
+
msgstr "Dodaj przycisk avatara do edytora wizualnego"
|
37 |
+
|
38 |
+
#: wp-user-avatar.php:1005
|
39 |
+
msgid "Allow Contributors & Subscribers to upload avatars"
|
40 |
+
msgstr "Pozwalaj kontrybutorom oraz subskrynentom przesyłać awatary"
|
41 |
+
|
42 |
+
#: wp-user-avatar.php:1011
|
43 |
+
msgid "Disable Gravatar and use only local avatars"
|
44 |
+
msgstr "Wyłącz gravatary i używaj tylko lokalnych awatarów"
|
45 |
+
|
46 |
+
#: wp-user-avatar.php:1022
|
47 |
+
#: wp-user-avatar.php:1027
|
48 |
+
msgid "Upload Size Limit"
|
49 |
+
msgstr "Limit wielkości pliku"
|
50 |
+
|
51 |
+
#: wp-user-avatar.php:1022
|
52 |
+
#: wp-user-avatar.php:1027
|
53 |
+
msgid "(only for Contributors & Subscribers)"
|
54 |
+
msgstr "(tylko dla subskrynentów i kontrybutorów)"
|
55 |
+
|
56 |
+
#: wp-user-avatar.php:1037
|
57 |
+
msgid "Allow users to edit avatars"
|
58 |
+
msgstr "Pozwalaj użytkownikom edytować awatary"
|
59 |
+
|
60 |
+
#: wp-user-avatar.php:1043
|
61 |
+
msgid "Resize avatars on upload"
|
62 |
+
msgstr "Zmieniaj rozmiar po przesłaniu"
|
63 |
+
|
64 |
+
#: wp-user-avatar.php:1055
|
65 |
+
msgid "Crop avatars to exact dimensions"
|
66 |
+
msgstr "Przytnij awatar do dokładnych rozmiarów"
|
67 |
+
|
68 |
+
#. Plugin Name of the plugin/theme
|
69 |
+
msgid "WP User Avatar"
|
70 |
+
msgstr "WP Awatar Użytkownika"
|
71 |
+
|
72 |
+
#. Plugin URI of the plugin/theme
|
73 |
+
msgid "http://wordpress.org/plugins/wp-user-avatar/"
|
74 |
+
msgstr "http://wordpress.org/plugins/wp-user-avatar/"
|
75 |
+
|
76 |
+
#. Description of the plugin/theme
|
77 |
+
msgid "Use any image from your WordPress Media Library as a custom user avatar. Add your own Default Avatar."
|
78 |
+
msgstr "Użyj dowolnego obrazka z biblioteki mediów jako awatar użytkownika. Dodaj swój własny domyślny awatar."
|
79 |
+
|
80 |
+
#. Author of the plugin/theme
|
81 |
+
msgid "Bangbay Siboliban"
|
82 |
+
msgstr "Bangbay Siboliban"
|
83 |
+
|
84 |
+
#. Author URI of the plugin/theme
|
85 |
+
msgid "http://siboliban.org/"
|
86 |
+
msgstr "http://siboliban.org/"
|
lang/wp-user-avatar-sv_SE.mo
CHANGED
Binary file
|
lang/wp-user-avatar-sv_SE.po
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# Swedish (sv_SE) translation for WP User Avatar.
|
2 |
-
# Copyright (C)
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
-
"Project-Id-Version: WP User Avatar 1.
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
-
"PO-Revision-Date:
|
10 |
"Language: sv_SE\n"
|
11 |
"Last-Translator: Mattias Tengblad <mst@eyesx.com>\n"
|
12 |
"Language-Team: WordPress Sverige <info@wpsv.se>\n"
|
@@ -14,32 +14,57 @@ msgstr ""
|
|
14 |
"Content-Type: text/plain; charset=UTF-8\n"
|
15 |
"Content-Transfer-Encoding: 8bit\n"
|
16 |
|
17 |
-
#: wp-user-avatar.php:
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
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:
|
27 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
28 |
msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
|
29 |
|
30 |
-
#: wp-user-avatar.php:
|
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:
|
35 |
-
#: wp-user-avatar.php:
|
36 |
-
msgid "Upload Size Limit
|
37 |
-
msgstr "Storleksgräns för uppladdningar
|
38 |
|
39 |
-
#: wp-user-avatar.php:
|
|
|
|
|
|
|
|
|
|
|
40 |
msgid "Allow users to edit avatars"
|
41 |
msgstr "Tillåt användare att redigera avatarer"
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
#. Plugin Name of the plugin/theme
|
44 |
msgid "WP User Avatar"
|
45 |
msgstr "Visningsbild (avatar)"
|
1 |
# Swedish (sv_SE) translation for WP User Avatar.
|
2 |
+
# Copyright (C) 2014 Bangbay Siboliban.
|
3 |
# This file is distributed under the same license as the WP User Avatar package.
|
4 |
#
|
5 |
msgid ""
|
6 |
msgstr ""
|
7 |
+
"Project-Id-Version: WP User Avatar 1.7.2\n"
|
8 |
"Report-Msgid-Bugs-To: http://wordpress.org/plugins/wp-user-avatar/\n"
|
9 |
+
"PO-Revision-Date: 2014-01-16 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:318
|
18 |
+
msgid "Do you like WP User Avatar?"
|
19 |
+
msgstr "Är du nöjd med Visningsbild (avatar)?"
|
20 |
+
|
21 |
+
#: wp-user-avatar.php:318
|
22 |
+
msgid "Make a donation."
|
23 |
+
msgstr "Donera"
|
24 |
+
|
25 |
+
#: wp-user-avatar.php:411
|
26 |
+
#: wp-user-avatar.php:925
|
27 |
msgid "Click %s to save your changes"
|
28 |
msgstr "Klicka på %s för att spara dina ändringar"
|
29 |
|
30 |
+
#: wp-user-avatar.php:536
|
31 |
+
msgid "Donate"
|
32 |
+
msgstr "Donera"
|
33 |
+
|
34 |
+
#: wp-user-avatar.php:999
|
35 |
msgid "Add avatar button to Visual Editor"
|
36 |
msgstr "Lägg till knapp för avatarer i den visuella redigeraren"
|
37 |
|
38 |
+
#: wp-user-avatar.php:1005
|
39 |
msgid "Allow Contributors & Subscribers to upload avatars"
|
40 |
msgstr "Tillåt medarbetare & prenumeranter att ladda upp avatarer"
|
41 |
|
42 |
+
#: wp-user-avatar.php:1011
|
43 |
msgid "Disable Gravatar and use only local avatars"
|
44 |
msgstr "Inaktivera Gravatar och använd endast lokala avatarer"
|
45 |
|
46 |
+
#: wp-user-avatar.php:1022
|
47 |
+
#: wp-user-avatar.php:1027
|
48 |
+
msgid "Upload Size Limit"
|
49 |
+
msgstr "Storleksgräns för uppladdningar"
|
50 |
|
51 |
+
#: wp-user-avatar.php:1022
|
52 |
+
#: wp-user-avatar.php:1027
|
53 |
+
msgid "(only for Contributors & Subscribers)"
|
54 |
+
msgstr "(endast för medarbetare & prenumeranter)"
|
55 |
+
|
56 |
+
#: wp-user-avatar.php:1037
|
57 |
msgid "Allow users to edit avatars"
|
58 |
msgstr "Tillåt användare att redigera avatarer"
|
59 |
|
60 |
+
#: wp-user-avatar.php:1043
|
61 |
+
msgid "Resize avatars on upload"
|
62 |
+
msgstr "Ändra storlek på avatarer på uppladdning"
|
63 |
+
|
64 |
+
#: wp-user-avatar.php:1055
|
65 |
+
msgid "Crop avatars to exact dimensions"
|
66 |
+
msgstr "Beskär avatarer till exakta dimensioner"
|
67 |
+
|
68 |
#. Plugin Name of the plugin/theme
|
69 |
msgid "WP User Avatar"
|
70 |
msgstr "Visningsbild (avatar)"
|
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.
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -13,16 +13,16 @@ Use any image from your WordPress Media Library as a custom user avatar. Add you
|
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
WordPress currently only allows you to use custom avatars that are uploaded through [Gravatar](http://gravatar.com/). WP User Avatar enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.
|
17 |
|
18 |
-
WP User Avatar also lets you:
|
19 |
|
20 |
* Upload your own Default Avatar in your WP User Avatar settings.
|
21 |
* Show the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar if the user doesn't have a WP User Avatar image.
|
22 |
* Disable [Gravatar](http://gravatar.com/) avatars and use only local avatars.
|
23 |
* Use the <code>[avatar]</code> shortcode in your posts. The shortcode will work with any theme, whether it has avatar support or not.
|
24 |
* Allow Contributors and Subscribers to upload their own avatars.
|
25 |
-
* Limit upload file size for Contributors and Subscribers.
|
26 |
|
27 |
== Installation ==
|
28 |
|
@@ -94,7 +94,13 @@ For comments, you must specify the $comment variable.
|
|
94 |
|
95 |
You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
|
96 |
|
97 |
-
`[avatar user="admin" size="medium" align="left" link="file"]`
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
= get_wp_user_avatar_src =
|
100 |
|
@@ -126,9 +132,10 @@ First, choose a theme that has avatar support. In your theme, you have a choice
|
|
126 |
|
127 |
1. Allows you to use the values "original", "large", "medium", or "thumbnail" for your avatar size.
|
128 |
2. Doesn't add a fixed width and height to the image if you use the aforementioned values. This will give you more flexibility to resize the image with CSS.
|
129 |
-
3.
|
130 |
-
4.
|
131 |
-
5. Shows
|
|
|
132 |
|
133 |
= get_avatar =
|
134 |
|
@@ -143,17 +150,9 @@ First, choose a theme that has avatar support. In your theme, you have a choice
|
|
143 |
= Can I create a custom Default Avatar? =
|
144 |
In your WP User Avatar settings, you can upload your own Default Avatar.
|
145 |
|
146 |
-
= Can I
|
147 |
-
|
148 |
-
You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
|
149 |
-
|
150 |
-
`[avatar user="admin" size="96" align="left" link="file"]`
|
151 |
-
|
152 |
-
Outputs:
|
153 |
|
154 |
-
|
155 |
-
<img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
|
156 |
-
</a>`
|
157 |
|
158 |
= Can Contributors or Subscribers choose their own WP User Avatar image? =
|
159 |
Yes, if you enable "Allow Contributors & Subscribers to upload avatars" in the WP User Avatar settings. These users will see a slightly different interface because they are allowed only one image upload.
|
@@ -162,14 +161,14 @@ Yes, if you enable "Allow Contributors & Subscribers to upload avatars" in the W
|
|
162 |
|
163 |
Yes, for registered users. Non-registered comment authors will show their [Gravatar](http://gravatar.com/) avatars or Default Avatar.
|
164 |
|
165 |
-
= Can I disable all Gravatar avatars? =
|
166 |
-
|
167 |
-
In your WP User Avatar settings, you can select "Disable Gravatar — Use only local avatars" to disable all [Gravatar](http://gravatar.com/) avatars on your site and replace them with your Default Avatar. This will affect your registered users and non-registered comment authors.
|
168 |
-
|
169 |
= Will WP User Avatar work with bbPress? =
|
170 |
|
171 |
Yes!
|
172 |
|
|
|
|
|
|
|
|
|
173 |
= Will WP User Avatar work with WordPress Multisite? =
|
174 |
|
175 |
Yes, however, each site has its own avatar settings. If you set a WP User Avatar image on one site, you have to set it again for different sites in your network.
|
@@ -178,6 +177,33 @@ Yes, however, each site has its own avatar settings. If you set a WP User Avatar
|
|
178 |
|
179 |
For Administrators, WP User Avatar adds a column with avatar thumbnails to your Users list table. If "Show Avatars" is enabled in your WP User Avatar settings, you will see avatars to the left of each username instead of in a new column.
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
= What CSS can I use with WP User Avatar? =
|
182 |
|
183 |
WP User Avatar will add the CSS classes "wp-user-avatar" and "wp-user-avatar-{size}" to your image. If you add an alignment, the corresponding alignment class will be added:
|
@@ -206,7 +232,7 @@ If you use the <code>[avatar]</code> shortcode, WP User Avatar will add the CSS
|
|
206 |
* Attachment: wp-user-avatar-attachment
|
207 |
* Custom URL: wp-user-avatar-custom
|
208 |
|
209 |
-
`[avatar user="admin" size="96" align="left" link="attachment"]`
|
210 |
|
211 |
Outputs:
|
212 |
|
@@ -219,6 +245,116 @@ Outputs:
|
|
219 |
* <code>has_wp_user_avatar</code>: checks if the user has a WP User Avatar image
|
220 |
* [See example usage here](http://wordpress.org/extend/plugins/wp-user-avatar/installation/)
|
221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
== Screenshots ==
|
223 |
|
224 |
1. WP User Avatar admin settings.
|
@@ -230,8 +366,72 @@ Outputs:
|
|
230 |
|
231 |
== Changelog ==
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
= 1.5.4 =
|
234 |
-
* Add: Option to enable avatar editing privilege for Subscribers
|
235 |
* Add: Swedish translation
|
236 |
* Update: Move inline JavaScript to wp-user-avatar.js and wp-user-avatar-admin.js
|
237 |
* Update: Load JavaScript in footer
|
@@ -263,7 +463,7 @@ Outputs:
|
|
263 |
* Bug Fix: Use wp_die for errors
|
264 |
|
265 |
= 1.4 =
|
266 |
-
* Add: Uploader for
|
267 |
* Add: Media states for avatar images
|
268 |
* Add: Plugin admin settings
|
269 |
* Update: Change support only to WP 3.4+
|
@@ -323,7 +523,7 @@ Outputs:
|
|
323 |
= 1.2 =
|
324 |
* Add: Default Avatar setting
|
325 |
|
326 |
-
= 1.1.7 =
|
327 |
* Bug Fix: Change update_usermeta to update_user_meta
|
328 |
|
329 |
= 1.1.6 =
|
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.8
|
8 |
+
Stable tag: 1.7.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
+
WordPress currently only allows you to use custom avatars that are uploaded through [Gravatar](http://gravatar.com/). **WP User Avatar** enables you to use any photo uploaded into your Media Library as an avatar. This means you use the same uploader and library as your posts. No extra folders or image editing functions are necessary.
|
17 |
|
18 |
+
**WP User Avatar** also lets you:
|
19 |
|
20 |
* Upload your own Default Avatar in your WP User Avatar settings.
|
21 |
* Show the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar if the user doesn't have a WP User Avatar image.
|
22 |
* Disable [Gravatar](http://gravatar.com/) avatars and use only local avatars.
|
23 |
* Use the <code>[avatar]</code> shortcode in your posts. The shortcode will work with any theme, whether it has avatar support or not.
|
24 |
* Allow Contributors and Subscribers to upload their own avatars.
|
25 |
+
* Limit upload file size and image dimensions for Contributors and Subscribers.
|
26 |
|
27 |
== Installation ==
|
28 |
|
94 |
|
95 |
You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
|
96 |
|
97 |
+
`[avatar user="admin" size="medium" align="left" link="file" /]`
|
98 |
+
|
99 |
+
You can also add a caption to the shortcode:
|
100 |
+
|
101 |
+
`[avatar user="admin" size="medium" align="left" link="file"]Photo Credit: Your Name[/avatar]`
|
102 |
+
|
103 |
+
**Note:** If you are using one shortcode without a caption and another shortcode with a caption on the same page, you must close the caption-less shortcode with a forward slash before the closing bracket: <code>[avatar /]</code> instead of <code>[avatar]</code>
|
104 |
|
105 |
= get_wp_user_avatar_src =
|
106 |
|
132 |
|
133 |
1. Allows you to use the values "original", "large", "medium", or "thumbnail" for your avatar size.
|
134 |
2. Doesn't add a fixed width and height to the image if you use the aforementioned values. This will give you more flexibility to resize the image with CSS.
|
135 |
+
3. Allows you to use custom image sizes registered with [<code>add_image_size</code>](http://codex.wordpress.org/Function_Reference/add_image_size) (fixed width and height are added to the image).
|
136 |
+
4. Optionally adds CSS classes "alignleft", "alignright", or "aligncenter" to position your avatar.
|
137 |
+
5. Shows nothing if the user has no WP User Avatar image.
|
138 |
+
6. Shows the user's [Gravatar](http://gravatar.com/) avatar or Default Avatar only if "Show Avatars" is enabled in your WP User Avatar settings.
|
139 |
|
140 |
= get_avatar =
|
141 |
|
150 |
= Can I create a custom Default Avatar? =
|
151 |
In your WP User Avatar settings, you can upload your own Default Avatar.
|
152 |
|
153 |
+
= Can I disable all Gravatar avatars? =
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
In your WP User Avatar settings, you can select "Disable Gravatar — Use only local avatars" to disable all [Gravatar](http://gravatar.com/) avatars on your site and replace them with your Default Avatar. This will affect your registered users and non-registered comment authors.
|
|
|
|
|
156 |
|
157 |
= Can Contributors or Subscribers choose their own WP User Avatar image? =
|
158 |
Yes, if you enable "Allow Contributors & Subscribers to upload avatars" in the WP User Avatar settings. These users will see a slightly different interface because they are allowed only one image upload.
|
161 |
|
162 |
Yes, for registered users. Non-registered comment authors will show their [Gravatar](http://gravatar.com/) avatars or Default Avatar.
|
163 |
|
|
|
|
|
|
|
|
|
164 |
= Will WP User Avatar work with bbPress? =
|
165 |
|
166 |
Yes!
|
167 |
|
168 |
+
= Will WP User Avatar work with BuddyPress? =
|
169 |
+
|
170 |
+
No, BuddyPress has its own custom avatar functions and WP User Avatar will override only some of them. It's best to use BuddyPress without WP User Avatar.
|
171 |
+
|
172 |
= Will WP User Avatar work with WordPress Multisite? =
|
173 |
|
174 |
Yes, however, each site has its own avatar settings. If you set a WP User Avatar image on one site, you have to set it again for different sites in your network.
|
177 |
|
178 |
For Administrators, WP User Avatar adds a column with avatar thumbnails to your Users list table. If "Show Avatars" is enabled in your WP User Avatar settings, you will see avatars to the left of each username instead of in a new column.
|
179 |
|
180 |
+
= Can I insert WP User Avatar directly into a post? =
|
181 |
+
|
182 |
+
You can use the <code>[avatar]</code> shortcode in your posts. It will detect the author of the post or you can specify an author by username. You can specify a size, alignment, and link, but they are optional. For links, you can link to the original image file, attachment page, or a custom URL.
|
183 |
+
|
184 |
+
`[avatar user="admin" size="96" align="left" link="file" /]`
|
185 |
+
|
186 |
+
Outputs:
|
187 |
+
|
188 |
+
`<a href="{fileURL}" class="wp-user-avatar-link wp-user-avatar-file">
|
189 |
+
<img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96 alignleft" />
|
190 |
+
</a>`
|
191 |
+
|
192 |
+
If you have a caption, the output will be similar to how WordPress adds captions to other images.
|
193 |
+
|
194 |
+
`[avatar user="admin" size="96" align="left" link="file"]Photo Credit: Your Name[/avatar]`
|
195 |
+
|
196 |
+
Outputs:
|
197 |
+
|
198 |
+
`<div style="width: 106px" class="wp-caption alignleft">
|
199 |
+
<a href="{fileURL}" class="wp-user-avatar-link wp-user-avatar-file">
|
200 |
+
<img src="{imageURL}" width="96" height="96" class="wp-user-avatar wp-user-avatar-96" />
|
201 |
+
</a>
|
202 |
+
<p class="wp-caption-text">Photo Credit: Your Name</p>
|
203 |
+
</div>`
|
204 |
+
|
205 |
+
**Note:** If you are using one shortcode without a caption and another shortcode with a caption on the same page, you must close the caption-less shortcode with a forward slash before the closing bracket: <code>[avatar /]</code> instead of <code>[avatar]</code>
|
206 |
+
|
207 |
= What CSS can I use with WP User Avatar? =
|
208 |
|
209 |
WP User Avatar will add the CSS classes "wp-user-avatar" and "wp-user-avatar-{size}" to your image. If you add an alignment, the corresponding alignment class will be added:
|
232 |
* Attachment: wp-user-avatar-attachment
|
233 |
* Custom URL: wp-user-avatar-custom
|
234 |
|
235 |
+
`[avatar user="admin" size="96" align="left" link="attachment" /]`
|
236 |
|
237 |
Outputs:
|
238 |
|
245 |
* <code>has_wp_user_avatar</code>: checks if the user has a WP User Avatar image
|
246 |
* [See example usage here](http://wordpress.org/extend/plugins/wp-user-avatar/installation/)
|
247 |
|
248 |
+
= There's a call for donations in the WP User Avatar settings. How can I remove it? =
|
249 |
+
I've spent countless hours developing this plugin for free. If you're able to give a donation I'd appreciate it, but it's by no means a requirement. You can remove the message by adding this to the <code>functions.php</code> file of your theme:
|
250 |
+
|
251 |
+
`remove_action('wpua_donation_message', 'wpua_do_donation_message');`
|
252 |
+
|
253 |
+
== Advanced Settings ==
|
254 |
+
|
255 |
+
= Add WP User Avatar to your own profile edit page =
|
256 |
+
|
257 |
+
If you're building your own profile edit page, WP User Avatar is automatically added to the [show_user_profile](http://codex.wordpress.org/Plugin_API/Action_Reference/show_user_profile) and [edit_user_profile](http://codex.wordpress.org/Plugin_API/Action_Reference/show_user_profile) hooks. If you'd rather have WP User Avatar in its own section, you could add another hook:
|
258 |
+
|
259 |
+
`do_action('edit_user_avatar', $current_user);`
|
260 |
+
|
261 |
+
Then, to add WP User Avatar to that hook and remove it from the other hooks outside of the administration panel, you would add this code to the <code>functions.php</code> file of your theme:
|
262 |
+
|
263 |
+
`function my_avatar_filter(){
|
264 |
+
// Remove from show_user_profile hook
|
265 |
+
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
|
266 |
+
remove_action('show_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
|
267 |
+
|
268 |
+
// Remove from edit_user_profile hook
|
269 |
+
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
|
270 |
+
remove_action('edit_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
|
271 |
+
|
272 |
+
// Add to edit_user_avatar hook
|
273 |
+
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_action_show_user_profile'));
|
274 |
+
add_action('edit_user_avatar', array('wp_user_avatar', 'wpua_media_upload_scripts'));
|
275 |
+
}
|
276 |
+
// Loads only outside of administration panel
|
277 |
+
if(!is_admin()){
|
278 |
+
add_action('plugins_loaded','my_avatar_filter');
|
279 |
+
}`
|
280 |
+
|
281 |
+
= HTML Wrapper =
|
282 |
+
|
283 |
+
You can change the HTML wrapper of the WP User Avatar section on your profile edit page by using the functions <code>wpua_before_avatar</code> and <code>wpua_after_avatar</code>. By default, the avatar code is structured like this:
|
284 |
+
|
285 |
+
`<h3>Avatar</h3>
|
286 |
+
<table class="form-table">
|
287 |
+
<tr>
|
288 |
+
<th><label for="wp_user_avatar">Image</label></th>
|
289 |
+
<td>
|
290 |
+
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="{attachmentID}" />
|
291 |
+
<p id="wpua-add-button">
|
292 |
+
<button type="button" class="button" id="wpua-add" name="wpua-add">Edit Image</button>
|
293 |
+
</p>
|
294 |
+
<p id="wpua-preview">
|
295 |
+
<img src="{imageURL}" alt="" />
|
296 |
+
Original Size
|
297 |
+
</p>
|
298 |
+
<p id="wpua-thumbnail">
|
299 |
+
<img src="{imageURL}" alt="" />
|
300 |
+
Thumbnail
|
301 |
+
</p>
|
302 |
+
<p id="wpua-remove-button">
|
303 |
+
<button type="button" class="button" id="wpua-remove" name="wpua-remove">Default Avatar</button>
|
304 |
+
</p>
|
305 |
+
<p id="wpua-undo-button">
|
306 |
+
<button type="button" class="button" id="wpua-undo" name="wpua-undo">Undo</button>
|
307 |
+
</p>
|
308 |
+
<p id="wpua-message">
|
309 |
+
Click “Update Profile” to save your changes
|
310 |
+
</p>
|
311 |
+
</td>
|
312 |
+
</tr>
|
313 |
+
</table>`
|
314 |
+
|
315 |
+
To strip out the table, you would add the following filters to the <code>functions.php</code> file in your theme:
|
316 |
+
|
317 |
+
`remove_action('wpua_before_avatar', 'wpua_do_before_avatar');
|
318 |
+
remove_action('wpua_after_avatar', 'wpua_do_after_avatar');`
|
319 |
+
|
320 |
+
To add your own wrapper, you could create something like this:
|
321 |
+
|
322 |
+
`function my_before_avatar(){
|
323 |
+
echo '<div id="my-avatar">';
|
324 |
+
}
|
325 |
+
add_action('wpua_before_avatar', 'my_before_avatar');
|
326 |
+
|
327 |
+
function my_after_avatar(){
|
328 |
+
echo '</div>';
|
329 |
+
}
|
330 |
+
add_action('wpua_after_avatar', 'my_after_avatar');`
|
331 |
+
|
332 |
+
This would output:
|
333 |
+
|
334 |
+
`<div id="my-avatar">
|
335 |
+
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="{attachmentID}" />
|
336 |
+
<p id="wpua-add-button">
|
337 |
+
<button type="button" class="button" id="wpua-add" name="wpua-add">Edit Image</button>
|
338 |
+
</p>
|
339 |
+
<p id="wpua-preview">
|
340 |
+
<img src="{imageURL}" alt="" />
|
341 |
+
Original Size
|
342 |
+
</p>
|
343 |
+
<p id="wpua-thumbnail">
|
344 |
+
<img src="{imageURL}" alt="" />
|
345 |
+
Thumbnail
|
346 |
+
</p>
|
347 |
+
<p id="wpua-remove-button">
|
348 |
+
<button type="button" class="button" id="wpua-remove" name="wpua-remove">Default Avatar</button>
|
349 |
+
</p>
|
350 |
+
<p id="wpua-undo-button">
|
351 |
+
<button type="button" class="button" id="wpua-undo" name="wpua-undo">Undo</button>
|
352 |
+
</p>
|
353 |
+
<p id="wpua-message">
|
354 |
+
Click “Update Profile” to save your changes
|
355 |
+
</p>
|
356 |
+
</div>`
|
357 |
+
|
358 |
== Screenshots ==
|
359 |
|
360 |
1. WP User Avatar admin settings.
|
366 |
|
367 |
== Changelog ==
|
368 |
|
369 |
+
= 1.7.2 =
|
370 |
+
* Bug Fix: Files not committed properly in previous release
|
371 |
+
|
372 |
+
= 1.7.1 =
|
373 |
+
* Update: Error message handling for front pages
|
374 |
+
|
375 |
+
= 1.7 =
|
376 |
+
* Add: Caption for avatar
|
377 |
+
* Add: Polish translation
|
378 |
+
* Update: Error message handling
|
379 |
+
|
380 |
+
= 1.6.8 =
|
381 |
+
* Bug Fix: Shortcode without user
|
382 |
+
|
383 |
+
= 1.6.7 =
|
384 |
+
* Add: Undo button
|
385 |
+
* Bug Fix: Get original avatar
|
386 |
+
|
387 |
+
= 1.6.6 =
|
388 |
+
* Add: Donation message
|
389 |
+
* Bug Fix: Die page when image is too large
|
390 |
+
* Bug Fix: Resize images uploaded through plugin only
|
391 |
+
* Remove: Unused function
|
392 |
+
* Update: Refactor JavaScript
|
393 |
+
|
394 |
+
= 1.6.5 =
|
395 |
+
* Bug Fix: Use entire comment object instead of just e-mail address
|
396 |
+
|
397 |
+
= 1.6.4 =
|
398 |
+
* Bug Fix: Correct avatar not showing in widget
|
399 |
+
* Update: Check compatibility to 3.7.1
|
400 |
+
|
401 |
+
= 1.6.3 =
|
402 |
+
* Bug Fix: Checkbox value for "Crop avatars to exact dimensions"
|
403 |
+
|
404 |
+
= 1.6.2 =
|
405 |
+
* Bug Fix: Show Default Avatar if attachment doesn't exist
|
406 |
+
* Bug Fix: manage_users_custom_column not returning values
|
407 |
+
|
408 |
+
= 1.6.1 =
|
409 |
+
* Bug Fix: Profile not saving without an avatar for Contributors & Subscribers
|
410 |
+
|
411 |
+
= 1.6.0 =
|
412 |
+
* Add: Filters to change profile HTML structure
|
413 |
+
* Add: Recognition of sizes registered with add_image_size
|
414 |
+
* Add: Resize image options for Contributors & Subscribers
|
415 |
+
* Bug Fix: Rerrange CSS class names
|
416 |
+
|
417 |
+
= 1.5.8 =
|
418 |
+
* Bug Fix: Add function exists checks to prevent redeclare errors
|
419 |
+
* Bug Fix: Page die if file upload is too big
|
420 |
+
* Bug Fix: Upload file with submit
|
421 |
+
|
422 |
+
= 1.5.7 =
|
423 |
+
* Bug Fix: Separate out JavaScript for Contributors & Subscribers
|
424 |
+
* Bug Fix: Subscriber uploader not finding error type
|
425 |
+
|
426 |
+
= 1.5.6 =
|
427 |
+
* Update: Use cache for wpua_has_gravatar
|
428 |
+
|
429 |
+
= 1.5.5 =
|
430 |
+
* Bug Fix: Hide "Edit Image" button if Contributors & Subscribers can't edit avatar
|
431 |
+
* Bug Fix: Remove edit_posts capability if Subscribers can't edit avatar
|
432 |
+
|
433 |
= 1.5.4 =
|
434 |
+
* Add: Option to enable avatar editing privilege for Contributors & Subscribers
|
435 |
* Add: Swedish translation
|
436 |
* Update: Move inline JavaScript to wp-user-avatar.js and wp-user-avatar-admin.js
|
437 |
* Update: Load JavaScript in footer
|
463 |
* Bug Fix: Use wp_die for errors
|
464 |
|
465 |
= 1.4 =
|
466 |
+
* Add: Uploader for Contributors & Subscribers
|
467 |
* Add: Media states for avatar images
|
468 |
* Add: Plugin admin settings
|
469 |
* Update: Change support only to WP 3.4+
|
523 |
= 1.2 =
|
524 |
* Add: Default Avatar setting
|
525 |
|
526 |
+
= 1.1.7.2 =
|
527 |
* Bug Fix: Change update_usermeta to update_user_meta
|
528 |
|
529 |
= 1.1.6 =
|
uninstall.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
-
* @version 1.
|
5 |
*/
|
6 |
|
7 |
// Remove user metadata and options on plugin delete
|
@@ -26,6 +26,10 @@ if(is_multisite()){
|
|
26 |
delete_option('wp_user_avatar_disable_gravatar');
|
27 |
delete_option('wp_user_avatar_edit_avatar');
|
28 |
delete_option('wp_user_avatar_load_scripts');
|
|
|
|
|
|
|
|
|
29 |
delete_option('wp_user_avatar_tinymce');
|
30 |
delete_option('wp_user_avatar_upload_size_limit');
|
31 |
delete_option('wp_user_avatar_default_avatar_updated');
|
@@ -41,6 +45,10 @@ if(is_multisite()){
|
|
41 |
delete_option('wp_user_avatar_disable_gravatar');
|
42 |
delete_option('wp_user_avatar_edit_avatar');
|
43 |
delete_option('wp_user_avatar_load_scripts');
|
|
|
|
|
|
|
|
|
44 |
delete_option('wp_user_avatar_tinymce');
|
45 |
delete_option('wp_user_avatar_upload_size_limit');
|
46 |
delete_option('wp_user_avatar_default_avatar_updated');
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
+
* @version 1.7.2
|
5 |
*/
|
6 |
|
7 |
// Remove user metadata and options on plugin delete
|
26 |
delete_option('wp_user_avatar_disable_gravatar');
|
27 |
delete_option('wp_user_avatar_edit_avatar');
|
28 |
delete_option('wp_user_avatar_load_scripts');
|
29 |
+
delete_option('wp_user_avatar_resize_crop');
|
30 |
+
delete_option('wp_user_avatar_resize_h');
|
31 |
+
delete_option('wp_user_avatar_resize_upload');
|
32 |
+
delete_option('wp_user_avatar_resize_w');
|
33 |
delete_option('wp_user_avatar_tinymce');
|
34 |
delete_option('wp_user_avatar_upload_size_limit');
|
35 |
delete_option('wp_user_avatar_default_avatar_updated');
|
45 |
delete_option('wp_user_avatar_disable_gravatar');
|
46 |
delete_option('wp_user_avatar_edit_avatar');
|
47 |
delete_option('wp_user_avatar_load_scripts');
|
48 |
+
delete_option('wp_user_avatar_resize_crop');
|
49 |
+
delete_option('wp_user_avatar_resize_h');
|
50 |
+
delete_option('wp_user_avatar_resize_upload');
|
51 |
+
delete_option('wp_user_avatar_resize_w');
|
52 |
delete_option('wp_user_avatar_tinymce');
|
53 |
delete_option('wp_user_avatar_upload_size_limit');
|
54 |
delete_option('wp_user_avatar_default_avatar_updated');
|
wp-user-avatar.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
-
* @version 1.
|
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.
|
13 |
Text Domain: wp-user-avatar
|
14 |
Domain Path: /lang/
|
15 |
*/
|
@@ -20,11 +20,18 @@ if(!defined('ABSPATH')){
|
|
20 |
}
|
21 |
|
22 |
// Define paths and variables
|
23 |
-
define('WPUA_VERSION', ' 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)));
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// Define global variables
|
29 |
$avatar_default = get_option('avatar_default');
|
30 |
$show_avatars = get_option('show_avatars');
|
@@ -32,24 +39,22 @@ $wpua_allow_upload = get_option('wp_user_avatar_allow_upload');
|
|
32 |
$wpua_avatar_default = get_option('avatar_default_wp_user_avatar');
|
33 |
$wpua_disable_gravatar = get_option('wp_user_avatar_disable_gravatar');
|
34 |
$wpua_edit_avatar = get_option('wp_user_avatar_edit_avatar');
|
|
|
|
|
|
|
|
|
35 |
$wpua_tinymce = get_option('wp_user_avatar_tinymce');
|
36 |
-
$mustache_original = WPUA_URLPATH.'images/
|
37 |
-
$mustache_medium = WPUA_URLPATH.'images/
|
38 |
-
$mustache_thumbnail = WPUA_URLPATH.'images/
|
39 |
-
$mustache_avatar = WPUA_URLPATH.'images/
|
40 |
-
$mustache_admin = WPUA_URLPATH.'images/
|
41 |
-
$ssl = is_ssl() ? 's' : "";
|
42 |
|
43 |
// Check for updates
|
44 |
$wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
|
45 |
$wpua_users_updated = get_option('wp_user_avatar_users_updated');
|
46 |
$wpua_media_updated = get_option('wp_user_avatar_media_updated');
|
47 |
|
48 |
-
// Max upload size
|
49 |
-
if(!function_exists('wp_max_upload_size')){
|
50 |
-
require_once(ABSPATH.'wp-admin/includes/template.php');
|
51 |
-
}
|
52 |
-
|
53 |
// Server upload size limit
|
54 |
$upload_size_limit = wp_max_upload_size();
|
55 |
// Convert to KB
|
@@ -71,6 +76,9 @@ if($wpua_user_upload_size_limit > 1024){
|
|
71 |
}
|
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');
|
@@ -91,6 +99,10 @@ function wpua_options(){
|
|
91 |
add_option('wp_user_avatar_allow_upload', '0');
|
92 |
add_option('wp_user_avatar_disable_gravatar', '0');
|
93 |
add_option('wp_user_avatar_edit_avatar', '1');
|
|
|
|
|
|
|
|
|
94 |
add_option('wp_user_avatar_tinymce', '1');
|
95 |
add_option('wp_user_avatar_upload_size_limit', '0');
|
96 |
}
|
@@ -162,7 +174,7 @@ if((bool) $wpua_allow_upload == 1){
|
|
162 |
add_action('user_edit_form_tag', 'wpua_add_edit_form_multipart_encoding');
|
163 |
|
164 |
// Check user role
|
165 |
-
function
|
166 |
global $current_user;
|
167 |
$user = is_numeric($user_id) ? get_userdata($user_id) : $current_user->ID;
|
168 |
if(empty($user)){
|
@@ -174,7 +186,7 @@ if((bool) $wpua_allow_upload == 1){
|
|
174 |
// Remove menu items
|
175 |
function wpua_subscriber_remove_menu_pages(){
|
176 |
global $current_user;
|
177 |
-
if(
|
178 |
remove_menu_page('edit.php');
|
179 |
remove_menu_page('edit-comments.php');
|
180 |
remove_menu_page('tools.php');
|
@@ -185,7 +197,7 @@ if((bool) $wpua_allow_upload == 1){
|
|
185 |
// Remove menu bar items
|
186 |
function wpua_subscriber_remove_menu_bar_items(){
|
187 |
global $current_user, $wp_admin_bar;
|
188 |
-
if(
|
189 |
$wp_admin_bar->remove_menu('comments');
|
190 |
$wp_admin_bar->remove_menu('new-content');
|
191 |
}
|
@@ -195,7 +207,7 @@ if((bool) $wpua_allow_upload == 1){
|
|
195 |
// Remove dashboard items
|
196 |
function wpua_subscriber_remove_dashboard_widgets(){
|
197 |
global $current_user;
|
198 |
-
if(
|
199 |
remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
|
200 |
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
|
201 |
remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
|
@@ -211,7 +223,7 @@ if((bool) $wpua_allow_upload == 1){
|
|
211 |
} else {
|
212 |
$offlimits = array('edit.php', 'edit-comments.php', 'post.php', 'post-new.php', 'tools.php');
|
213 |
}
|
214 |
-
if(
|
215 |
if(in_array($pagenow, $offlimits)){
|
216 |
do_action('admin_page_access_denied');
|
217 |
wp_die(__('You do not have sufficient permissions to access this page.'));
|
@@ -250,17 +262,76 @@ function wpua_deactivate(){
|
|
250 |
update_option('avatar_default', 'mystery');
|
251 |
}
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
// WP User Avatar
|
254 |
if(!class_exists('wp_user_avatar')){
|
255 |
class wp_user_avatar{
|
256 |
function wp_user_avatar(){
|
257 |
-
global $current_screen, $current_user, $pagenow, $show_avatars, $wpua_allow_upload, $wpua_upload_size_limit;
|
258 |
// Add WPUA to profile
|
259 |
if(current_user_can('upload_files') || ((bool) $wpua_allow_upload == 1 && is_user_logged_in())){
|
260 |
-
// For themes that use this function
|
261 |
-
if(!function_exists('get_current_screen')){
|
262 |
-
require_once(ABSPATH.'wp-admin/includes/screen.php');
|
263 |
-
}
|
264 |
// Profile functions and scripts
|
265 |
add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
|
266 |
add_action('edit_user_profile', array($this, 'wpua_action_show_user_profile'));
|
@@ -272,23 +343,30 @@ if(!class_exists('wp_user_avatar')){
|
|
272 |
if($pagenow == 'options-discussion.php' || ($pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page'] == 'wp-user-avatar')){
|
273 |
add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
|
274 |
}
|
275 |
-
// Prefilter upload size
|
276 |
if(!current_user_can('upload_files')){
|
277 |
-
|
|
|
|
|
|
|
278 |
}
|
279 |
// Admin menu settings
|
280 |
add_action('admin_menu', 'wpua_admin');
|
281 |
-
add_filter('plugin_action_links', array($this, '
|
|
|
282 |
// Hide column in Users table if default avatars are enabled
|
283 |
if((bool) $show_avatars == 0 && is_admin()){
|
284 |
add_filter('manage_users_columns', array($this, 'wpua_add_column'), 10, 1);
|
285 |
add_filter('manage_users_custom_column', array($this, 'wpua_show_column'), 10, 3);
|
286 |
}
|
|
|
|
|
|
|
|
|
|
|
287 |
}
|
288 |
}
|
289 |
-
|
290 |
// Add to edit user profile
|
291 |
-
function wpua_action_show_user_profile($user){
|
292 |
global $blog_id, $current_user, $post, $show_avatars, $wpdb, $wpua_allow_upload, $wpua_edit_avatar, $wpua_upload_size_limit_with_units;
|
293 |
// Get WPUA attachment ID
|
294 |
$wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
@@ -303,31 +381,22 @@ if(!class_exists('wp_user_avatar')){
|
|
303 |
// Change text on message based on current user
|
304 |
$profile = ($current_user->ID == $user->ID) ? '“'.__('Update Profile').'”' : '“'.__('Update User').'”';
|
305 |
?>
|
306 |
-
<?php
|
307 |
-
<h2 class="entry-title"><?php _e('Avatar'); ?></h2>
|
308 |
-
<fieldset class="bbp-form">
|
309 |
-
<legend><?php _e('Image'); ?></legend>
|
310 |
-
<?php else : // Add to profile with admin style ?>
|
311 |
-
<h3><?php _e('Avatar') ?></h3>
|
312 |
-
<table class="form-table">
|
313 |
-
<tr>
|
314 |
-
<th><label for="wp_user_avatar"><?php _e('Image'); ?></label></th>
|
315 |
-
<td>
|
316 |
-
<?php endif; ?>
|
317 |
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?>" />
|
318 |
<?php if(current_user_can('upload_files')) : // Button to launch Media uploader ?>
|
319 |
-
<p><button type="button" class="button" id="wpua-add" name="wpua-add"><?php _e('Edit Image'); ?></button></p>
|
320 |
<?php elseif(!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) : // Upload button ?>
|
321 |
-
<
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
327 |
</p>
|
328 |
<?php elseif((bool) $wpua_edit_avatar == 1 && !current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) : // Edit button ?>
|
329 |
<?php $edit_attachment_link = add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')); ?>
|
330 |
-
<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>
|
331 |
<?php endif; ?>
|
332 |
<p id="wpua-preview">
|
333 |
<img src="<?php echo $avatar_medium; ?>" alt="" />
|
@@ -337,31 +406,47 @@ if(!class_exists('wp_user_avatar')){
|
|
337 |
<img src="<?php echo $avatar_thumbnail; ?>" alt="" />
|
338 |
<?php _e('Thumbnail'); ?>
|
339 |
</p>
|
340 |
-
<p
|
|
|
341 |
<p id="wpua-message"><?php printf(__('Click %s to save your changes', 'wp-user-avatar'), $profile); ?></p>
|
342 |
-
<?php
|
343 |
-
</fieldset>
|
344 |
-
<?php else : // Add to profile with admin style ?>
|
345 |
-
</td>
|
346 |
-
</tr>
|
347 |
-
</table>
|
348 |
-
<?php endif; ?>
|
349 |
<?php
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
// Set upload size limit for users without upload_files capability
|
353 |
function wpua_handle_upload_prefilter($file){
|
354 |
global $wpua_upload_size_limit;
|
355 |
$size = $file['size'];
|
356 |
-
if($size > $wpua_upload_size_limit){
|
357 |
-
|
|
|
|
|
|
|
|
|
358 |
}
|
359 |
return $file;
|
360 |
}
|
361 |
|
362 |
// Update user meta
|
363 |
function wpua_action_process_option_update($user_id){
|
364 |
-
global $blog_id, $wpdb;
|
365 |
// Check if user has upload_files capability
|
366 |
if(current_user_can('upload_files')){
|
367 |
$wpua_id = isset($_POST['wp-user-avatar']) ? intval($_POST['wp-user-avatar']) : "";
|
@@ -369,83 +454,74 @@ if(!class_exists('wp_user_avatar')){
|
|
369 |
add_post_meta($wpua_id, '_wp_attachment_wp_user_avatar', $user_id);
|
370 |
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $wpua_id);
|
371 |
} else {
|
|
|
372 |
if(isset($_POST['wp-user-avatar']) && empty($_POST['wp-user-avatar'])){
|
373 |
// Uploads by user
|
374 |
-
$attachments = $wpdb->get_results($wpdb->prepare("SELECT
|
375 |
foreach($attachments as $attachment){
|
376 |
// Delete attachment if not used by another user
|
377 |
if(!wpua_image($attachment->ID, $user_id)){
|
378 |
-
|
379 |
}
|
380 |
}
|
381 |
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', "");
|
382 |
}
|
383 |
// Create attachment from upload
|
384 |
-
if(isset($_POST['
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
|
|
|
|
398 |
}
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
-
}
|
412 |
-
// Construct the attachment array
|
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'])){
|
420 |
-
unset($attachment['ID']);
|
421 |
-
}
|
422 |
-
// Save the attachment metadata
|
423 |
-
$attachment_id = wp_insert_attachment($attachment, $file);
|
424 |
-
if(!is_wp_error($attachment_id)){
|
425 |
-
require_once(ABSPATH.'wp-admin/includes/image.php');
|
426 |
-
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
|
427 |
-
$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_wp_attachment_wp_user_avatar', $user_id));
|
428 |
-
add_post_meta($attachment_id, '_wp_attachment_wp_user_avatar', $user_id);
|
429 |
-
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $attachment_id);
|
430 |
}
|
431 |
}
|
432 |
}
|
433 |
}
|
434 |
|
435 |
-
// Add
|
436 |
-
function
|
437 |
-
$image = wp_get_attachment_image_src($post->ID, "medium");
|
438 |
-
$button = '<button type="button" class="button" id="set-wp-user-avatar-image" name="set-wp-user-avatar-image" onclick="wpuaSetAvatar(\''.$post->ID.'\', \''.$image[0].'\')">'.__('Select Image').'</button>';
|
439 |
-
$fields['wp-user-avatar'] = array(
|
440 |
-
'label' => __('WP User Avatar', 'wp-user-avatar'),
|
441 |
-
'input' => 'html',
|
442 |
-
'html' => $button
|
443 |
-
);
|
444 |
-
return $fields;
|
445 |
-
}
|
446 |
-
|
447 |
-
// Add settings link on plugin page
|
448 |
-
function wpua_plugin_settings_links($links, $file){
|
449 |
if(basename($file) == basename(plugin_basename(__FILE__))){
|
450 |
$settings_link = '<a href="'.add_query_arg(array('page' => 'wp-user-avatar'), admin_url('options-general.php')).'">'.__('Settings').'</a>';
|
451 |
$links = array_merge($links, array($settings_link));
|
@@ -453,6 +529,16 @@ if(!class_exists('wp_user_avatar')){
|
|
453 |
return $links;
|
454 |
}
|
455 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
// Add column to Users table
|
457 |
function wpua_add_column($columns){
|
458 |
return $columns + array('wp-user-avatar' => __('WP User Avatar', 'wp-user-avatar'));
|
@@ -463,20 +549,21 @@ if(!class_exists('wp_user_avatar')){
|
|
463 |
global $blog_id, $wpdb;
|
464 |
$wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
465 |
$wpua_image = wp_get_attachment_image($wpua, array(32,32));
|
466 |
-
if($column_name == 'wp-user-avatar'){
|
467 |
-
|
468 |
-
}
|
469 |
}
|
470 |
|
471 |
// Media uploader
|
472 |
-
function wpua_media_upload_scripts($user=""){
|
473 |
global $mustache_admin, $pagenow, $show_avatars, $wpua_upload_size_limit;
|
474 |
wp_enqueue_script('jquery');
|
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 +588,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 +595,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 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
$
|
|
|
|
|
517 |
}
|
|
|
518 |
return $has_gravatar;
|
519 |
}
|
520 |
|
@@ -528,17 +617,17 @@ if(!class_exists('wp_user_avatar')){
|
|
528 |
$user_id = !empty($user) ? $user->ID : "";
|
529 |
}
|
530 |
$wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
531 |
-
$has_wpua = !empty($wpua) ? true : false;
|
532 |
return $has_wpua;
|
533 |
}
|
534 |
|
535 |
// Replace get_avatar only in get_wp_user_avatar
|
536 |
function wpua_get_avatar_filter($avatar, $id_or_email="", $size="", $default="", $alt=""){
|
537 |
-
global $avatar_default, $
|
538 |
// User has WPUA
|
539 |
if(is_object($id_or_email)){
|
540 |
-
if(!empty($
|
541 |
-
$avatar = get_wp_user_avatar($
|
542 |
} else {
|
543 |
$avatar = get_wp_user_avatar('unknown@gravatar.com', $size, $default, $alt);
|
544 |
}
|
@@ -551,14 +640,13 @@ if(!class_exists('wp_user_avatar')){
|
|
551 |
// User doesn't have WPUA or Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
|
552 |
} elseif($avatar_default == 'wp_user_avatar'){
|
553 |
// Show custom Default Avatar
|
554 |
-
if(!empty($wpua_avatar_default)){
|
555 |
// Get image
|
556 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
557 |
// Image src
|
558 |
$default = $wpua_avatar_default_image[0];
|
559 |
// Add dimensions if numeric size
|
560 |
$dimensions = ' width="'.$wpua_avatar_default_image[1].'" height="'.$wpua_avatar_default_image[2].'"';
|
561 |
-
$defaultcss = "";
|
562 |
} else {
|
563 |
// Get mustache image based on numeric size comparison
|
564 |
if($size > get_option('medium_size_w')){
|
@@ -574,10 +662,9 @@ if(!class_exists('wp_user_avatar')){
|
|
574 |
}
|
575 |
// Add dimensions if numeric size
|
576 |
$dimensions = ' width="'.$size.'" height="'.$size.'"';
|
577 |
-
$defaultcss = ' avatar-default';
|
578 |
}
|
579 |
// Construct the img tag
|
580 |
-
$avatar =
|
581 |
}
|
582 |
}
|
583 |
return $avatar;
|
@@ -587,15 +674,13 @@ if(!class_exists('wp_user_avatar')){
|
|
587 |
// Get original avatar, for when user removes wp_user_avatar
|
588 |
function wpua_get_avatar_original($id_or_email, $size="", $default="", $alt=""){
|
589 |
global $avatar_default, $mustache_avatar, $wpua_avatar_default, $wpua_disable_gravatar;
|
590 |
-
// Remove get_avatar filter
|
591 |
-
|
592 |
-
remove_filter('get_avatar', 'wpua_get_avatar_filter');
|
593 |
-
}
|
594 |
if((bool) $wpua_disable_gravatar != 1){
|
595 |
// User doesn't have Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
|
596 |
if(!wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar'){
|
597 |
// Show custom Default Avatar
|
598 |
-
if(!empty($wpua_avatar_default)){
|
599 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
600 |
$default = $wpua_avatar_default_image[0];
|
601 |
} else {
|
@@ -606,35 +691,37 @@ if(!class_exists('wp_user_avatar')){
|
|
606 |
$wpua_image = get_avatar($id_or_email, $size);
|
607 |
// Takes the img tag, extracts the src
|
608 |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
|
609 |
-
$default = $matches [0] [1];
|
610 |
}
|
611 |
} else {
|
612 |
-
if(!empty($wpua_avatar_default)){
|
613 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
614 |
$default = $wpua_avatar_default_image[0];
|
615 |
} else {
|
616 |
$default = $mustache_avatar;
|
617 |
}
|
618 |
}
|
|
|
|
|
619 |
return $default;
|
620 |
}
|
621 |
|
622 |
// Find WPUA, show get_avatar if empty
|
623 |
-
function get_wp_user_avatar($id_or_email="", $size='96', $align="", $alt=""){
|
624 |
-
global $avatar_default, $blog_id, $
|
625 |
// Checks if comment
|
626 |
if(is_object($id_or_email)){
|
627 |
// Checks if comment author is registered user by user ID
|
628 |
-
if($
|
629 |
-
$
|
630 |
// Checks that comment author isn't anonymous
|
631 |
-
} elseif(!empty($
|
632 |
// Checks if comment author is registered user by e-mail address
|
633 |
-
$user = get_user_by('email', $
|
634 |
// Get registered user info from profile, otherwise e-mail address should be value
|
635 |
-
$
|
636 |
}
|
637 |
-
$alt = $
|
638 |
} else {
|
639 |
if(!empty($id_or_email)){
|
640 |
// Find user by ID or e-mail address
|
@@ -653,14 +740,14 @@ if(!class_exists('wp_user_avatar')){
|
|
653 |
}
|
654 |
// Set user's ID and name
|
655 |
if(!empty($user)){
|
656 |
-
$
|
657 |
$alt = $user->display_name;
|
658 |
}
|
659 |
}
|
660 |
// Checks if user has WPUA
|
661 |
-
$wpua_meta =
|
662 |
// Add alignment class
|
663 |
-
$alignclass = !empty($align) ? ' align'.$align :
|
664 |
// User has WPUA, bypass get_avatar
|
665 |
if(!empty($wpua_meta)){
|
666 |
// Numeric size use size array
|
@@ -670,24 +757,29 @@ if(!class_exists('wp_user_avatar')){
|
|
670 |
// Add dimensions to img only if numeric size was specified
|
671 |
$dimensions = is_numeric($size) ? ' width="'.$wpua_image[1].'" height="'.$wpua_image[2].'"' : "";
|
672 |
// Construct the img tag
|
673 |
-
$avatar = '<img src="'.$wpua_image[0].'"'.$dimensions.' alt="'.$alt.'" class="wp-user-avatar wp-user-avatar-'.$size.$alignclass.'
|
674 |
} else {
|
675 |
-
//
|
676 |
-
if($size
|
677 |
-
|
|
|
|
|
|
|
|
|
678 |
} else {
|
679 |
// Numeric sizes leave as-is
|
680 |
$get_size = $size;
|
681 |
}
|
682 |
// User with no WPUA uses get_avatar
|
683 |
-
$avatar = get_avatar($
|
684 |
// Remove width and height for non-numeric sizes
|
685 |
-
if(
|
686 |
-
$avatar = preg_replace("/(width|height)=\'\d*\'\s/", "", $avatar);
|
687 |
$avatar = preg_replace('/(width|height)=\"\d*\"\s/', "", $avatar);
|
688 |
-
$avatar =
|
689 |
-
$avatar = str_replace("class='", "class='wp-user-avatar wp-user-avatar-".$size.$alignclass." ", $avatar);
|
690 |
}
|
|
|
|
|
|
|
691 |
}
|
692 |
return $avatar;
|
693 |
}
|
@@ -700,14 +792,14 @@ if(!class_exists('wp_user_avatar')){
|
|
700 |
// Takes the img tag, extracts the src
|
701 |
if(!empty($wpua_image)){
|
702 |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
|
703 |
-
$wpua_image_src = $matches [0] [1];
|
704 |
}
|
705 |
return $wpua_image_src;
|
706 |
}
|
707 |
|
708 |
// Shortcode
|
709 |
-
function wpua_shortcode($atts, $content){
|
710 |
-
global $blog_id, $wpdb;
|
711 |
// Set shortcode attributes
|
712 |
extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts));
|
713 |
// Find user by ID, login, slug, or e-mail address
|
@@ -715,31 +807,66 @@ if(!class_exists('wp_user_avatar')){
|
|
715 |
$user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user);
|
716 |
$user = empty($user) ? get_user_by('slug', $user) : $user;
|
717 |
$user = empty($user) ? get_user_by('email', $user) : $user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
}
|
719 |
// Get user ID
|
720 |
-
$id_or_email = !empty($user) ? $user->ID :
|
721 |
// Check if link is set
|
722 |
if(!empty($link)){
|
723 |
// CSS class is same as link type, except for URL
|
724 |
$link_class = $link;
|
725 |
-
// Open in new window
|
726 |
-
$target_link = !empty($target) ? ' target="'.$target.'"' : "";
|
727 |
if($link == 'file'){
|
728 |
// Get image src
|
729 |
-
$
|
730 |
} elseif($link == 'attachment'){
|
731 |
// Get attachment URL
|
732 |
-
$
|
733 |
} else {
|
734 |
// URL
|
735 |
-
$image_link = $link;
|
736 |
$link_class = 'custom';
|
737 |
}
|
|
|
|
|
738 |
// Wrap the avatar inside the link
|
739 |
-
$
|
740 |
} else {
|
741 |
-
|
742 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
}
|
744 |
return $avatar;
|
745 |
}
|
@@ -776,7 +903,7 @@ if(!class_exists('wp_user_avatar')){
|
|
776 |
$avatar_list .= '<br />';
|
777 |
}
|
778 |
// Show remove link if custom Default Avatar is set
|
779 |
-
if(!empty($wpua_avatar_default)){
|
780 |
$avatar_thumb_src = wp_get_attachment_image_src($wpua_avatar_default, array(32,32));
|
781 |
$avatar_thumb = $avatar_thumb_src[0];
|
782 |
$hide_remove = "";
|
@@ -793,7 +920,7 @@ if(!class_exists('wp_user_avatar')){
|
|
793 |
$wpua_list .= preg_replace("/src='(.+?)'/", "src='\$1'", $avatar_thumb_img);
|
794 |
$wpua_list .= ' '.__('WP User Avatar', 'wp-user-avatar').'</label>';
|
795 |
$wpua_list .= '<p id="wpua-edit"><button type="button" class="button" id="wpua-add" name="wpua-add">'.__('Edit Image').'</button>';
|
796 |
-
$wpua_list .= '<a href="#" id="wpua-remove"'
|
797 |
$wpua_list .= '<input type="hidden" id="wp-user-avatar" name="avatar_default_wp_user_avatar" value="'.$wpua_avatar_default.'">';
|
798 |
$wpua_list .= '<p id="wpua-message">'.sprintf(__('Click %s to save your changes', 'wp-user-avatar'), '“'.__('Save Changes').'”').'</p>';
|
799 |
if((bool) $wpua_disable_gravatar != 1){
|
@@ -846,19 +973,21 @@ if(!class_exists('wp_user_avatar')){
|
|
846 |
|
847 |
// Admin page
|
848 |
function wpua_options_page(){
|
849 |
-
global $show_avatars, $upload_size_limit_with_units, $wpua_allow_upload, $wpua_disable_gravatar, $wpua_edit_avatar, $wpua_tinymce, $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
|
850 |
// Give subscribers edit_posts capability
|
851 |
if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && (empty($wpua_allow_upload) || empty($wpua_edit_avatar))){
|
852 |
wpua_subscriber_remove_cap();
|
853 |
}
|
854 |
-
$hide_size = (bool) $wpua_allow_upload != 1 ? '
|
|
|
855 |
?>
|
856 |
<div class="wrap">
|
857 |
<?php screen_icon(); ?>
|
858 |
<h2><?php _e('WP User Avatar', 'wp-user-avatar'); ?></h2>
|
859 |
-
<form method="post" action="options.php">
|
860 |
<?php settings_fields('wpua-settings-group'); ?>
|
861 |
<?php do_settings_fields('wpua-settings-group', ""); ?>
|
|
|
862 |
<table class="form-table">
|
863 |
<tr valign="top">
|
864 |
<th scope="row"><?php _e('Settings'); ?></th>
|
@@ -869,12 +998,14 @@ if(!class_exists('wp_user_avatar')){
|
|
869 |
<input name="wp_user_avatar_tinymce" type="checkbox" id="wp_user_avatar_tinymce" value="1" <?php checked($wpua_tinymce, 1); ?> />
|
870 |
<?php _e('Add avatar button to Visual Editor', 'wp-user-avatar'); ?>
|
871 |
</label>
|
872 |
-
|
|
|
873 |
<label for="wp_user_avatar_allow_upload">
|
874 |
<input name="wp_user_avatar_allow_upload" type="checkbox" id="wp_user_avatar_allow_upload" value="1" <?php checked($wpua_allow_upload, 1); ?> />
|
875 |
<?php _e('Allow Contributors & Subscribers to upload avatars', 'wp-user-avatar'); ?>
|
876 |
</label>
|
877 |
-
|
|
|
878 |
<label for="wp_user_avatar_disable_gravatar">
|
879 |
<input name="wp_user_avatar_disable_gravatar" type="checkbox" id="wp_user_avatar_disable_gravatar" value="1" <?php checked($wpua_disable_gravatar, 1); ?> />
|
880 |
<?php _e('Disable Gravatar and use only local avatars', 'wp-user-avatar'); ?>
|
@@ -882,29 +1013,51 @@ if(!class_exists('wp_user_avatar')){
|
|
882 |
</fieldset>
|
883 |
</td>
|
884 |
</tr>
|
885 |
-
<tr id="wpua-size-limit" valign="top"<?php echo $hide_size; ?>>
|
886 |
-
<th scope="row">
|
887 |
-
<label for="wp_user_avatar_upload_size_limit">
|
888 |
-
<?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?>
|
889 |
-
</label>
|
890 |
-
</th>
|
891 |
-
<td>
|
892 |
-
<fieldset>
|
893 |
-
<legend class="screen-reader-text"><span><?php _e('Upload Size Limit (only for Contributors & Subscribers)', 'wp-user-avatar'); ?></span></legend>
|
894 |
-
<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" />
|
895 |
-
<span id="wpua-readable-size"><?php echo $wpua_upload_size_limit_with_units; ?></span>
|
896 |
-
<span id="wpua-readable-size-error"><?php printf(__('%s exceeds the maximum upload size for this site.'), ""); ?></span>
|
897 |
-
<div id="wpua-slider"></div>
|
898 |
-
<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>
|
899 |
-
<br />
|
900 |
-
<label for="wp_user_avatar_edit_avatar">
|
901 |
-
<input name="wp_user_avatar_edit_avatar" type="checkbox" id="wp_user_avatar_edit_avatar" value="1" <?php checked($wpua_edit_avatar, 1); ?> />
|
902 |
-
<?php _e('Allow users to edit avatars', 'wp-user-avatar'); ?>
|
903 |
-
</label>
|
904 |
-
</fieldset>
|
905 |
-
</td>
|
906 |
-
</tr>
|
907 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
<h3 class="title"><?php _e('Avatars'); ?></h3>
|
909 |
<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p>
|
910 |
<table class="form-table">
|
@@ -967,6 +1120,10 @@ if(!class_exists('wp_user_avatar')){
|
|
967 |
register_setting('wpua-settings-group', 'wp_user_avatar_allow_upload', 'intval');
|
968 |
register_setting('wpua-settings-group', 'wp_user_avatar_disable_gravatar', 'intval');
|
969 |
register_setting('wpua-settings-group', 'wp_user_avatar_edit_avatar', 'intval');
|
|
|
|
|
|
|
|
|
970 |
register_setting('wpua-settings-group', 'wp_user_avatar_upload_size_limit', 'intval');
|
971 |
}
|
972 |
|
@@ -983,4 +1140,5 @@ if(!class_exists('wp_user_avatar')){
|
|
983 |
}
|
984 |
add_action('plugins_loaded', 'wpua_load');
|
985 |
}
|
|
|
986 |
?>
|
1 |
<?php
|
2 |
/**
|
3 |
* @package WP User Avatar
|
4 |
+
* @version 1.7.2
|
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.7.2
|
13 |
Text Domain: wp-user-avatar
|
14 |
Domain Path: /lang/
|
15 |
*/
|
20 |
}
|
21 |
|
22 |
// Define paths and variables
|
23 |
+
define('WPUA_VERSION', ' 1.7.2');
|
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)));
|
27 |
|
28 |
+
// Include WordPress functions
|
29 |
+
require_once(ABSPATH.'wp-admin/includes/file.php');
|
30 |
+
require_once(ABSPATH.'wp-admin/includes/image.php');
|
31 |
+
require_once(ABSPATH.'wp-admin/includes/media.php');
|
32 |
+
require_once(ABSPATH.'wp-admin/includes/screen.php');
|
33 |
+
require_once(ABSPATH.'wp-admin/includes/template.php');
|
34 |
+
|
35 |
// Define global variables
|
36 |
$avatar_default = get_option('avatar_default');
|
37 |
$show_avatars = get_option('show_avatars');
|
39 |
$wpua_avatar_default = get_option('avatar_default_wp_user_avatar');
|
40 |
$wpua_disable_gravatar = get_option('wp_user_avatar_disable_gravatar');
|
41 |
$wpua_edit_avatar = get_option('wp_user_avatar_edit_avatar');
|
42 |
+
$wpua_resize_crop = get_option('wp_user_avatar_resize_crop');
|
43 |
+
$wpua_resize_h = get_option('wp_user_avatar_resize_h');
|
44 |
+
$wpua_resize_upload = get_option('wp_user_avatar_resize_upload');
|
45 |
+
$wpua_resize_w = get_option('wp_user_avatar_resize_w');
|
46 |
$wpua_tinymce = get_option('wp_user_avatar_tinymce');
|
47 |
+
$mustache_original = WPUA_URLPATH.'images/wpua.png';
|
48 |
+
$mustache_medium = WPUA_URLPATH.'images/wpua-300x300.png';
|
49 |
+
$mustache_thumbnail = WPUA_URLPATH.'images/wpua-150x150.png';
|
50 |
+
$mustache_avatar = WPUA_URLPATH.'images/wpua-96x96.png';
|
51 |
+
$mustache_admin = WPUA_URLPATH.'images/wpua-32x32.png';
|
|
|
52 |
|
53 |
// Check for updates
|
54 |
$wpua_default_avatar_updated = get_option('wp_user_avatar_default_avatar_updated');
|
55 |
$wpua_users_updated = get_option('wp_user_avatar_users_updated');
|
56 |
$wpua_media_updated = get_option('wp_user_avatar_media_updated');
|
57 |
|
|
|
|
|
|
|
|
|
|
|
58 |
// Server upload size limit
|
59 |
$upload_size_limit = wp_max_upload_size();
|
60 |
// Convert to KB
|
76 |
}
|
77 |
$wpua_upload_size_limit_with_units = (int) $wpua_user_upload_size_limit.'KB';
|
78 |
|
79 |
+
// Check for custom image sizes
|
80 |
+
$all_sizes = array_merge(get_intermediate_image_sizes(), array('original'));
|
81 |
+
|
82 |
// Load add-ons
|
83 |
if((bool) $wpua_tinymce == 1){
|
84 |
include_once(WPUA_ABSPATH.'includes/tinymce.php');
|
99 |
add_option('wp_user_avatar_allow_upload', '0');
|
100 |
add_option('wp_user_avatar_disable_gravatar', '0');
|
101 |
add_option('wp_user_avatar_edit_avatar', '1');
|
102 |
+
add_option('wp_user_avatar_resize_crop', '0');
|
103 |
+
add_option('wp_user_avatar_resize_h', '96');
|
104 |
+
add_option('wp_user_avatar_resize_upload', '0');
|
105 |
+
add_option('wp_user_avatar_resize_w', '96');
|
106 |
add_option('wp_user_avatar_tinymce', '1');
|
107 |
add_option('wp_user_avatar_upload_size_limit', '0');
|
108 |
}
|
174 |
add_action('user_edit_form_tag', 'wpua_add_edit_form_multipart_encoding');
|
175 |
|
176 |
// Check user role
|
177 |
+
function wpua_check_user_role($role, $user_id=null){
|
178 |
global $current_user;
|
179 |
$user = is_numeric($user_id) ? get_userdata($user_id) : $current_user->ID;
|
180 |
if(empty($user)){
|
186 |
// Remove menu items
|
187 |
function wpua_subscriber_remove_menu_pages(){
|
188 |
global $current_user;
|
189 |
+
if(wpua_check_user_role('subscriber', $current_user->ID)){
|
190 |
remove_menu_page('edit.php');
|
191 |
remove_menu_page('edit-comments.php');
|
192 |
remove_menu_page('tools.php');
|
197 |
// Remove menu bar items
|
198 |
function wpua_subscriber_remove_menu_bar_items(){
|
199 |
global $current_user, $wp_admin_bar;
|
200 |
+
if(wpua_check_user_role('subscriber', $current_user->ID)){
|
201 |
$wp_admin_bar->remove_menu('comments');
|
202 |
$wp_admin_bar->remove_menu('new-content');
|
203 |
}
|
207 |
// Remove dashboard items
|
208 |
function wpua_subscriber_remove_dashboard_widgets(){
|
209 |
global $current_user;
|
210 |
+
if(wpua_check_user_role('subscriber', $current_user->ID)){
|
211 |
remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
|
212 |
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
|
213 |
remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
|
223 |
} else {
|
224 |
$offlimits = array('edit.php', 'edit-comments.php', 'post.php', 'post-new.php', 'tools.php');
|
225 |
}
|
226 |
+
if(wpua_check_user_role('subscriber', $current_user->ID)){
|
227 |
if(in_array($pagenow, $offlimits)){
|
228 |
do_action('admin_page_access_denied');
|
229 |
wp_die(__('You do not have sufficient permissions to access this page.'));
|
262 |
update_option('avatar_default', 'mystery');
|
263 |
}
|
264 |
|
265 |
+
// Before wrapper for profile
|
266 |
+
function wpua_before_avatar(){
|
267 |
+
do_action('wpua_before_avatar');
|
268 |
+
}
|
269 |
+
|
270 |
+
// After wrapper for profile
|
271 |
+
function wpua_after_avatar(){
|
272 |
+
do_action('wpua_after_avatar');
|
273 |
+
}
|
274 |
+
|
275 |
+
// Before avatar container
|
276 |
+
function wpua_do_before_avatar(){ ?>
|
277 |
+
<?php if(class_exists('bbPress') && bbp_is_edit()) : // Add to bbPress profile with same style ?>
|
278 |
+
<h2 class="entry-title"><?php _e('Avatar'); ?></h2>
|
279 |
+
<fieldset class="bbp-form">
|
280 |
+
<legend><?php _e('Image'); ?></legend>
|
281 |
+
<?php elseif(class_exists('WPUF_Main') && is_page()) : // Add to WP User Frontend profile with same style ?>
|
282 |
+
<fieldset>
|
283 |
+
<legend><?php _e('Avatar') ?></legend>
|
284 |
+
<table class="wpuf-table">
|
285 |
+
<tr>
|
286 |
+
<th><label for="wp_user_avatar"><?php _e('Image'); ?></label></th>
|
287 |
+
<td>
|
288 |
+
<?php else : // Add to profile with admin style ?>
|
289 |
+
<h3><?php _e('Avatar') ?></h3>
|
290 |
+
<table class="form-table">
|
291 |
+
<tr>
|
292 |
+
<th><label for="wp_user_avatar"><?php _e('Image'); ?></label></th>
|
293 |
+
<td>
|
294 |
+
<?php endif; ?>
|
295 |
+
<?php
|
296 |
+
}
|
297 |
+
|
298 |
+
// After avatar container
|
299 |
+
function wpua_do_after_avatar(){ ?>
|
300 |
+
<?php if(class_exists('bbPress') && bbp_is_edit()) : // Add to bbPress profile with same style ?>
|
301 |
+
</fieldset>
|
302 |
+
<?php elseif(class_exists('WPUF_Main') && is_page()) : // Add to WP User Frontend profile with same style ?>
|
303 |
+
</td>
|
304 |
+
</tr>
|
305 |
+
</table>
|
306 |
+
</fieldset>
|
307 |
+
<?php else : // Add to profile with admin style ?>
|
308 |
+
</td>
|
309 |
+
</tr>
|
310 |
+
</table>
|
311 |
+
<?php endif; ?>
|
312 |
+
<?php
|
313 |
+
}
|
314 |
+
|
315 |
+
// Donate message
|
316 |
+
function wpua_do_donation_message(){ ?>
|
317 |
+
<div class="updated">
|
318 |
+
<p><?php _e('Do you like WP User Avatar?', 'wp-user-avatar'); ?> <a href="http://siboliban.org/donate" target="_blank"><?php _e('Make a donation.', 'wp-user-avatar'); ?></a></p>
|
319 |
+
</div>
|
320 |
+
<?php
|
321 |
+
}
|
322 |
+
|
323 |
+
// Filter for the inevitable complaints about the donation message
|
324 |
+
function wpua_donation_message(){
|
325 |
+
do_action('wpua_donation_message');
|
326 |
+
}
|
327 |
+
|
328 |
// WP User Avatar
|
329 |
if(!class_exists('wp_user_avatar')){
|
330 |
class wp_user_avatar{
|
331 |
function wp_user_avatar(){
|
332 |
+
global $current_screen, $current_user, $pagenow, $show_avatars, $wpua_allow_upload, $wpua_resize_upload, $wpua_upload_size_limit;
|
333 |
// Add WPUA to profile
|
334 |
if(current_user_can('upload_files') || ((bool) $wpua_allow_upload == 1 && is_user_logged_in())){
|
|
|
|
|
|
|
|
|
335 |
// Profile functions and scripts
|
336 |
add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
|
337 |
add_action('edit_user_profile', array($this, 'wpua_action_show_user_profile'));
|
343 |
if($pagenow == 'options-discussion.php' || ($pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page'] == 'wp-user-avatar')){
|
344 |
add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
|
345 |
}
|
|
|
346 |
if(!current_user_can('upload_files')){
|
347 |
+
// Upload errors
|
348 |
+
add_action('user_profile_update_errors', array($this, 'wpua_upload_errors'), 10, 3);
|
349 |
+
// Prefilter upload size
|
350 |
+
add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'));
|
351 |
}
|
352 |
// Admin menu settings
|
353 |
add_action('admin_menu', 'wpua_admin');
|
354 |
+
add_filter('plugin_action_links', array($this, 'wpua_action_links'), 10, 2);
|
355 |
+
add_filter('plugin_row_meta', array($this, 'wpua_row_meta'), 10, 2);
|
356 |
// Hide column in Users table if default avatars are enabled
|
357 |
if((bool) $show_avatars == 0 && is_admin()){
|
358 |
add_filter('manage_users_columns', array($this, 'wpua_add_column'), 10, 1);
|
359 |
add_filter('manage_users_custom_column', array($this, 'wpua_show_column'), 10, 3);
|
360 |
}
|
361 |
+
// Profile wrappers
|
362 |
+
add_action('wpua_before_avatar', 'wpua_do_before_avatar');
|
363 |
+
add_action('wpua_after_avatar', 'wpua_do_after_avatar');
|
364 |
+
// Donate message
|
365 |
+
add_action('wpua_donation_message', 'wpua_do_donation_message');
|
366 |
}
|
367 |
}
|
|
|
368 |
// Add to edit user profile
|
369 |
+
public static function wpua_action_show_user_profile($user){
|
370 |
global $blog_id, $current_user, $post, $show_avatars, $wpdb, $wpua_allow_upload, $wpua_edit_avatar, $wpua_upload_size_limit_with_units;
|
371 |
// Get WPUA attachment ID
|
372 |
$wpua = get_user_meta($user->ID, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
381 |
// Change text on message based on current user
|
382 |
$profile = ($current_user->ID == $user->ID) ? '“'.__('Update Profile').'”' : '“'.__('Update User').'”';
|
383 |
?>
|
384 |
+
<?php do_action('wpua_before_avatar'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
<input type="hidden" name="wp-user-avatar" id="wp-user-avatar" value="<?php echo $wpua; ?>" />
|
386 |
<?php if(current_user_can('upload_files')) : // Button to launch Media uploader ?>
|
387 |
+
<p id="wpua-add-button"><button type="button" class="button" id="wpua-add" name="wpua-add"><?php _e('Edit Image'); ?></button></p>
|
388 |
<?php elseif(!current_user_can('upload_files') && !has_wp_user_avatar($current_user->ID)) : // Upload button ?>
|
389 |
+
<p id="wpua-upload-button">
|
390 |
+
<input name="wpua-file" id="wpua-file" type="file" />
|
391 |
+
<button type="submit" class="button" id="wpua-upload" name="submit" value="<?php _e('Upload'); ?>"><?php _e('Upload'); ?></button>
|
392 |
+
</p>
|
393 |
+
<p id="wpua-upload-messages">
|
394 |
+
<span id="wpua-max-upload"><?php printf(__('Maximum upload file size: %d%s.'), esc_html($wpua_upload_size_limit_with_units), esc_html('KB')); ?></span>
|
395 |
+
<span id="wpua-allowed-files"><?php _e('Allowed Files'); ?>: <?php _e('<code>jpg jpeg png gif</code>'); ?></span>
|
396 |
</p>
|
397 |
<?php elseif((bool) $wpua_edit_avatar == 1 && !current_user_can('upload_files') && has_wp_user_avatar($current_user->ID) && wpua_author($wpua, $current_user->ID)) : // Edit button ?>
|
398 |
<?php $edit_attachment_link = add_query_arg(array('post' => $wpua, 'action' => 'edit'), admin_url('post.php')); ?>
|
399 |
+
<p id="wpua-edit-button"><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>
|
400 |
<?php endif; ?>
|
401 |
<p id="wpua-preview">
|
402 |
<img src="<?php echo $avatar_medium; ?>" alt="" />
|
406 |
<img src="<?php echo $avatar_thumbnail; ?>" alt="" />
|
407 |
<?php _e('Thumbnail'); ?>
|
408 |
</p>
|
409 |
+
<p id="wpua-remove-button" class="<?php echo $hide_remove; ?>"><button type="button" class="button" id="wpua-remove" name="wpua-remove"><?php _e('Default Avatar'); ?></button></p>
|
410 |
+
<p id="wpua-undo-button"><button type="button" class="button" id="wpua-undo" name="wpua-undo"><?php _e('Undo'); ?></button></p>
|
411 |
<p id="wpua-message"><?php printf(__('Click %s to save your changes', 'wp-user-avatar'), $profile); ?></p>
|
412 |
+
<?php do_action('wpua_after_avatar'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
<?php
|
414 |
}
|
415 |
|
416 |
+
// Add upload error messages
|
417 |
+
function wpua_upload_errors($errors, $update, $user){
|
418 |
+
global $wpua_upload_size_limit;
|
419 |
+
if($update && !empty($_FILES['wpua-file'])){
|
420 |
+
$size = $_FILES['wpua-file']['size'];
|
421 |
+
$type = $_FILES['wpua-file']['type'];
|
422 |
+
// Allow only JPG, GIF, PNG
|
423 |
+
if(!empty($type) && !preg_match('/(jpe?g|gif|png)$/i', $type)){
|
424 |
+
$errors->add('wpua_file_type', __('This file is not an image. Please try another.'));
|
425 |
+
}
|
426 |
+
// Upload size limit
|
427 |
+
if(!empty($size) && $size > $wpua_upload_size_limit){
|
428 |
+
$errors->add('wpua_file_size', __('Memory exceeded. Please try another smaller file.'));
|
429 |
+
}
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
// Set upload size limit for users without upload_files capability
|
434 |
function wpua_handle_upload_prefilter($file){
|
435 |
global $wpua_upload_size_limit;
|
436 |
$size = $file['size'];
|
437 |
+
if(!empty($size) && $size > $wpua_upload_size_limit){
|
438 |
+
function wpua_file_size_error($errors, $update, $user){
|
439 |
+
$errors->add('wpua_file_size', __('Memory exceeded. Please try another smaller file.'));
|
440 |
+
}
|
441 |
+
add_action('user_profile_update_errors', 'wpua_file_size_error', 10, 3);
|
442 |
+
return null;
|
443 |
}
|
444 |
return $file;
|
445 |
}
|
446 |
|
447 |
// Update user meta
|
448 |
function wpua_action_process_option_update($user_id){
|
449 |
+
global $blog_id, $wpdb, $wpua_resize_crop, $wpua_resize_h, $wpua_resize_upload, $wpua_resize_w;
|
450 |
// Check if user has upload_files capability
|
451 |
if(current_user_can('upload_files')){
|
452 |
$wpua_id = isset($_POST['wp-user-avatar']) ? intval($_POST['wp-user-avatar']) : "";
|
454 |
add_post_meta($wpua_id, '_wp_attachment_wp_user_avatar', $user_id);
|
455 |
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $wpua_id);
|
456 |
} else {
|
457 |
+
// Remove attachment info if avatar is blank
|
458 |
if(isset($_POST['wp-user-avatar']) && empty($_POST['wp-user-avatar'])){
|
459 |
// Uploads by user
|
460 |
+
$attachments = $wpdb->get_results($wpdb->prepare("SELECT $wpdb->posts.ID FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->posts.post_author = %d AND $wpdb->posts.post_type = %s AND $wpdb->postmeta.meta_key = %s AND $wpdb->postmeta.meta_value = $wpdb->posts.post_author", $user_id, 'attachment', '_wp_attachment_wp_user_avatar'));
|
461 |
foreach($attachments as $attachment){
|
462 |
// Delete attachment if not used by another user
|
463 |
if(!wpua_image($attachment->ID, $user_id)){
|
464 |
+
wp_delete_attachment($attachment->ID);
|
465 |
}
|
466 |
}
|
467 |
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', "");
|
468 |
}
|
469 |
// Create attachment from upload
|
470 |
+
if(isset($_POST['submit']) && $_POST['submit'] && !empty($_FILES['wpua-file'])){
|
471 |
+
$name = $_FILES['wpua-file']['name'];
|
472 |
+
$file = wp_handle_upload($_FILES['wpua-file'], array('test_form' => false));
|
473 |
+
$type = $_FILES['wpua-file']['type'];
|
474 |
+
if(!empty($type) && preg_match('/(jpe?g|gif|png)$/i', $type)){
|
475 |
+
// Resize uploaded image
|
476 |
+
if((bool) $wpua_resize_upload == 1){
|
477 |
+
// Original image
|
478 |
+
$uploaded_image = wp_get_image_editor($file['file']);
|
479 |
+
// Check for errors
|
480 |
+
if(!is_wp_error($uploaded_image)){
|
481 |
+
// Resize image
|
482 |
+
$uploaded_image->resize($wpua_resize_w, $wpua_resize_h, $wpua_resize_crop);
|
483 |
+
// Save image
|
484 |
+
$resized_image = $uploaded_image->save($file['file']);
|
485 |
+
}
|
486 |
}
|
487 |
+
// Break out file info
|
488 |
+
$name_parts = pathinfo($name);
|
489 |
+
$name = trim(substr($name, 0, -(1 + strlen($name_parts['extension']))));
|
490 |
+
$url = $file['url'];
|
491 |
+
$file = $file['file'];
|
492 |
+
$title = $name;
|
493 |
+
// Use image exif/iptc data for title if possible
|
494 |
+
if($image_meta = @wp_read_image_metadata($file)){
|
495 |
+
if(trim($image_meta['title']) && !is_numeric(sanitize_title($image_meta['title']))){
|
496 |
+
$title = $image_meta['title'];
|
497 |
+
}
|
498 |
+
}
|
499 |
+
// Construct the attachment array
|
500 |
+
$attachment = array(
|
501 |
+
'guid' => $url,
|
502 |
+
'post_mime_type' => $type,
|
503 |
+
'post_title' => $title,
|
504 |
+
'post_content' => ""
|
505 |
+
);
|
506 |
+
// This should never be set as it would then overwrite an existing attachment
|
507 |
+
if(isset($attachment['ID'])){
|
508 |
+
unset($attachment['ID']);
|
509 |
+
}
|
510 |
+
// Save the attachment metadata
|
511 |
+
$attachment_id = wp_insert_attachment($attachment, $file);
|
512 |
+
if(!is_wp_error($attachment_id)){
|
513 |
+
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
|
514 |
+
$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_key = %s AND meta_value = %d", '_wp_attachment_wp_user_avatar', $user_id));
|
515 |
+
add_post_meta($attachment_id, '_wp_attachment_wp_user_avatar', $user_id);
|
516 |
+
update_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', $attachment_id);
|
517 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
}
|
520 |
}
|
521 |
}
|
522 |
|
523 |
+
// Add actions links on plugin page
|
524 |
+
function wpua_action_links($links, $file){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
if(basename($file) == basename(plugin_basename(__FILE__))){
|
526 |
$settings_link = '<a href="'.add_query_arg(array('page' => 'wp-user-avatar'), admin_url('options-general.php')).'">'.__('Settings').'</a>';
|
527 |
$links = array_merge($links, array($settings_link));
|
529 |
return $links;
|
530 |
}
|
531 |
|
532 |
+
// Add row meta on plugin page
|
533 |
+
function wpua_row_meta($links, $file){
|
534 |
+
if(basename($file) == basename(plugin_basename(__FILE__))){
|
535 |
+
$support_link = '<a href="http://wordpress.org/support/plugin/wp-user-avatar" target="_blank">'.__('Support Forums').'</a>';
|
536 |
+
$donate_link = '<a href="http://siboliban.org/donate" target="_blank">'.__('Donate', 'wp-user-avatar').'</a>';
|
537 |
+
$links = array_merge($links, array($support_link, $donate_link));
|
538 |
+
}
|
539 |
+
return $links;
|
540 |
+
}
|
541 |
+
|
542 |
// Add column to Users table
|
543 |
function wpua_add_column($columns){
|
544 |
return $columns + array('wp-user-avatar' => __('WP User Avatar', 'wp-user-avatar'));
|
549 |
global $blog_id, $wpdb;
|
550 |
$wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
551 |
$wpua_image = wp_get_attachment_image($wpua, array(32,32));
|
552 |
+
if($column_name == 'wp-user-avatar'){ $value = $wpua_image; }
|
553 |
+
return $value;
|
|
|
554 |
}
|
555 |
|
556 |
// Media uploader
|
557 |
+
public static function wpua_media_upload_scripts($user=""){
|
558 |
global $mustache_admin, $pagenow, $show_avatars, $wpua_upload_size_limit;
|
559 |
wp_enqueue_script('jquery');
|
560 |
if(current_user_can('upload_files')){
|
561 |
wp_enqueue_script('admin-bar');
|
562 |
wp_enqueue_media();
|
563 |
+
wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar.js', array('jquery','media-editor'), WPUA_VERSION, true);
|
564 |
+
} else {
|
565 |
+
wp_enqueue_script('wp-user-avatar', WPUA_URLPATH.'js/wp-user-avatar-user.js', array('jquery'), WPUA_VERSION, true);
|
566 |
}
|
|
|
567 |
wp_enqueue_style('wp-user-avatar', WPUA_URLPATH.'css/wp-user-avatar.css', "", WPUA_VERSION);
|
568 |
// Admin scripts
|
569 |
if($pagenow == 'options-discussion.php' || ($pagenow == 'options-general.php' && isset($_GET['page']) && $_GET['page'] == 'wp-user-avatar')){
|
588 |
|
589 |
// Returns true if user has Gravatar-hosted image
|
590 |
function wpua_has_gravatar($id_or_email, $has_gravatar=false, $user="", $email=""){
|
|
|
591 |
if(!is_object($id_or_email) && !empty($id_or_email)){
|
592 |
// Find user by ID or e-mail address
|
593 |
$user = is_numeric($id_or_email) ? get_user_by('id', $id_or_email) : get_user_by('email', $id_or_email);
|
595 |
$email = !empty($user) ? $user->user_email : "";
|
596 |
}
|
597 |
// Check if Gravatar image returns 200 (OK) or 404 (Not Found)
|
598 |
+
$hash = md5(strtolower(trim($email)));
|
599 |
+
$gravatar = 'http://www.gravatar.com/avatar/'.$hash.'?d=404';
|
600 |
+
$data = wp_cache_get($hash);
|
601 |
+
if(false === $data){
|
602 |
+
$response = wp_remote_head($gravatar);
|
603 |
+
$data = is_wp_error($response) ? 'not200' : $response['response']['code'];
|
604 |
+
wp_cache_set($hash, $data, $group="", $expire=60*5);
|
605 |
}
|
606 |
+
$has_gravatar = ($data == '200') ? true : false;
|
607 |
return $has_gravatar;
|
608 |
}
|
609 |
|
617 |
$user_id = !empty($user) ? $user->ID : "";
|
618 |
}
|
619 |
$wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
620 |
+
$has_wpua = !empty($wpua) && wp_attachment_is_image($wpua) ? true : false;
|
621 |
return $has_wpua;
|
622 |
}
|
623 |
|
624 |
// Replace get_avatar only in get_wp_user_avatar
|
625 |
function wpua_get_avatar_filter($avatar, $id_or_email="", $size="", $default="", $alt=""){
|
626 |
+
global $avatar_default, $mustache_admin, $mustache_avatar, $mustache_medium, $mustache_original, $mustache_thumbnail, $post, $wpua_avatar_default, $wpua_disable_gravatar;
|
627 |
// User has WPUA
|
628 |
if(is_object($id_or_email)){
|
629 |
+
if(!empty($id_or_email->comment_author_email)){
|
630 |
+
$avatar = get_wp_user_avatar($id_or_email, $size, $default, $alt);
|
631 |
} else {
|
632 |
$avatar = get_wp_user_avatar('unknown@gravatar.com', $size, $default, $alt);
|
633 |
}
|
640 |
// User doesn't have WPUA or Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
|
641 |
} elseif($avatar_default == 'wp_user_avatar'){
|
642 |
// Show custom Default Avatar
|
643 |
+
if(!empty($wpua_avatar_default) && wp_attachment_is_image($wpua_avatar_default)){
|
644 |
// Get image
|
645 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
646 |
// Image src
|
647 |
$default = $wpua_avatar_default_image[0];
|
648 |
// Add dimensions if numeric size
|
649 |
$dimensions = ' width="'.$wpua_avatar_default_image[1].'" height="'.$wpua_avatar_default_image[2].'"';
|
|
|
650 |
} else {
|
651 |
// Get mustache image based on numeric size comparison
|
652 |
if($size > get_option('medium_size_w')){
|
662 |
}
|
663 |
// Add dimensions if numeric size
|
664 |
$dimensions = ' width="'.$size.'" height="'.$size.'"';
|
|
|
665 |
}
|
666 |
// Construct the img tag
|
667 |
+
$avatar = '<img src="'.$default.'"'.$dimensions.' alt="'.$alt.'" class="avatar avatar-'.$size.' wp-user-avatar wp-user-avatar-'.$size.' photo avatar-default" />';
|
668 |
}
|
669 |
}
|
670 |
return $avatar;
|
674 |
// Get original avatar, for when user removes wp_user_avatar
|
675 |
function wpua_get_avatar_original($id_or_email, $size="", $default="", $alt=""){
|
676 |
global $avatar_default, $mustache_avatar, $wpua_avatar_default, $wpua_disable_gravatar;
|
677 |
+
// Remove get_avatar filter
|
678 |
+
remove_filter('get_avatar', 'wpua_get_avatar_filter');
|
|
|
|
|
679 |
if((bool) $wpua_disable_gravatar != 1){
|
680 |
// User doesn't have Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar
|
681 |
if(!wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar'){
|
682 |
// Show custom Default Avatar
|
683 |
+
if(!empty($wpua_avatar_default) && wp_attachment_is_image($wpua_avatar_default)){
|
684 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
685 |
$default = $wpua_avatar_default_image[0];
|
686 |
} else {
|
691 |
$wpua_image = get_avatar($id_or_email, $size);
|
692 |
// Takes the img tag, extracts the src
|
693 |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
|
694 |
+
$default = !empty($matches) ? $matches [0] [1] : "";
|
695 |
}
|
696 |
} else {
|
697 |
+
if(!empty($wpua_avatar_default) && wp_attachment_is_image($wpua_avatar_default)){
|
698 |
$wpua_avatar_default_image = wp_get_attachment_image_src($wpua_avatar_default, array($size,$size));
|
699 |
$default = $wpua_avatar_default_image[0];
|
700 |
} else {
|
701 |
$default = $mustache_avatar;
|
702 |
}
|
703 |
}
|
704 |
+
// Enable get_avatar filter
|
705 |
+
add_filter('get_avatar', 'wpua_get_avatar_filter', 10, 6);
|
706 |
return $default;
|
707 |
}
|
708 |
|
709 |
// Find WPUA, show get_avatar if empty
|
710 |
+
function get_wp_user_avatar($id_or_email="", $size='96', $align="", $alt="", $email='unknown@gravatar.com'){
|
711 |
+
global $all_sizes, $avatar_default, $blog_id, $post, $wpdb, $_wp_additional_image_sizes;
|
712 |
// Checks if comment
|
713 |
if(is_object($id_or_email)){
|
714 |
// Checks if comment author is registered user by user ID
|
715 |
+
if($id_or_email->user_id != 0){
|
716 |
+
$email = $id_or_email->user_id;
|
717 |
// Checks that comment author isn't anonymous
|
718 |
+
} elseif(!empty($id_or_email->comment_author_email)){
|
719 |
// Checks if comment author is registered user by e-mail address
|
720 |
+
$user = get_user_by('email', $id_or_email->comment_author_email);
|
721 |
// Get registered user info from profile, otherwise e-mail address should be value
|
722 |
+
$email = !empty($user) ? $user->ID : $id_or_email->comment_author_email;
|
723 |
}
|
724 |
+
$alt = $id_or_email->comment_author;
|
725 |
} else {
|
726 |
if(!empty($id_or_email)){
|
727 |
// Find user by ID or e-mail address
|
740 |
}
|
741 |
// Set user's ID and name
|
742 |
if(!empty($user)){
|
743 |
+
$email = $user->ID;
|
744 |
$alt = $user->display_name;
|
745 |
}
|
746 |
}
|
747 |
// Checks if user has WPUA
|
748 |
+
$wpua_meta = get_the_author_meta($wpdb->get_blog_prefix($blog_id).'user_avatar', $email);
|
749 |
// Add alignment class
|
750 |
+
$alignclass = !empty($align) && ($align == 'left' || $align == 'right' || $align == 'center') ? ' align'.$align : ' alignnone';
|
751 |
// User has WPUA, bypass get_avatar
|
752 |
if(!empty($wpua_meta)){
|
753 |
// Numeric size use size array
|
757 |
// Add dimensions to img only if numeric size was specified
|
758 |
$dimensions = is_numeric($size) ? ' width="'.$wpua_image[1].'" height="'.$wpua_image[2].'"' : "";
|
759 |
// Construct the img tag
|
760 |
+
$avatar = '<img src="'.$wpua_image[0].'"'.$dimensions.' alt="'.$alt.'" class="avatar avatar-'.$size.' wp-user-avatar wp-user-avatar-'.$size.$alignclass.' photo" />';
|
761 |
} else {
|
762 |
+
// Check for custom image sizes
|
763 |
+
if(in_array($size, $all_sizes)){
|
764 |
+
if(in_array($size, array('original', 'large', 'medium', 'thumbnail'))){
|
765 |
+
$get_size = ($size == 'original') ? get_option('large_size_w') : get_option($size.'_size_w');
|
766 |
+
} else {
|
767 |
+
$get_size = $_wp_additional_image_sizes[$size]['width'];
|
768 |
+
}
|
769 |
} else {
|
770 |
// Numeric sizes leave as-is
|
771 |
$get_size = $size;
|
772 |
}
|
773 |
// User with no WPUA uses get_avatar
|
774 |
+
$avatar = get_avatar($email, $get_size, $default="", $alt="");
|
775 |
// Remove width and height for non-numeric sizes
|
776 |
+
if(in_array($size, array('original', 'large', 'medium', 'thumbnail'))){
|
|
|
777 |
$avatar = preg_replace('/(width|height)=\"\d*\"\s/', "", $avatar);
|
778 |
+
$avatar = preg_replace("/(width|height)=\'\d*\'\s/", "", $avatar);
|
|
|
779 |
}
|
780 |
+
$str_replacemes = array('wp-user-avatar ', 'wp-user-avatar-'.$get_size.' ', 'wp-user-avatar-'.$size.' ', 'avatar-'.$get_size, 'photo');
|
781 |
+
$str_replacements = array("", "", "", 'avatar-'.$size, 'wp-user-avatar wp-user-avatar-'.$size.$alignclass.' photo');
|
782 |
+
$avatar = str_replace($str_replacemes, $str_replacements, $avatar);
|
783 |
}
|
784 |
return $avatar;
|
785 |
}
|
792 |
// Takes the img tag, extracts the src
|
793 |
if(!empty($wpua_image)){
|
794 |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER);
|
795 |
+
$wpua_image_src = !empty($matches) ? $matches [0] [1] : "";
|
796 |
}
|
797 |
return $wpua_image_src;
|
798 |
}
|
799 |
|
800 |
// Shortcode
|
801 |
+
function wpua_shortcode($atts, $content=null){
|
802 |
+
global $all_sizes, $blog_id, $post, $wpdb;
|
803 |
// Set shortcode attributes
|
804 |
extract(shortcode_atts(array('user' => "", 'size' => '96', 'align' => "", 'link' => "", 'target' => ""), $atts));
|
805 |
// Find user by ID, login, slug, or e-mail address
|
807 |
$user = is_numeric($user) ? get_user_by('id', $user) : get_user_by('login', $user);
|
808 |
$user = empty($user) ? get_user_by('slug', $user) : $user;
|
809 |
$user = empty($user) ? get_user_by('email', $user) : $user;
|
810 |
+
} else {
|
811 |
+
// Find author's name if id_or_email is empty
|
812 |
+
$author_name = get_query_var('author_name');
|
813 |
+
if(is_author()){
|
814 |
+
// On author page, get user by page slug
|
815 |
+
$user = get_user_by('slug', $author_name);
|
816 |
+
} else {
|
817 |
+
// On post, get user by author meta
|
818 |
+
$user_id = get_the_author_meta('ID');
|
819 |
+
$user = get_user_by('id', $user_id);
|
820 |
+
}
|
821 |
+
}
|
822 |
+
// Numeric sizes leave as-is
|
823 |
+
$get_size = $size;
|
824 |
+
// Check for custom image sizes if there are captions
|
825 |
+
if(!empty($content)){
|
826 |
+
if(in_array($size, $all_sizes)){
|
827 |
+
if(in_array($size, array('original', 'large', 'medium', 'thumbnail'))){
|
828 |
+
$get_size = ($size == 'original') ? get_option('large_size_w') : get_option($size.'_size_w');
|
829 |
+
} else {
|
830 |
+
$get_size = $_wp_additional_image_sizes[$size]['width'];
|
831 |
+
}
|
832 |
+
}
|
833 |
}
|
834 |
// Get user ID
|
835 |
+
$id_or_email = !empty($user) ? $user->ID : 'unknown@gravatar.com';
|
836 |
// Check if link is set
|
837 |
if(!empty($link)){
|
838 |
// CSS class is same as link type, except for URL
|
839 |
$link_class = $link;
|
|
|
|
|
840 |
if($link == 'file'){
|
841 |
// Get image src
|
842 |
+
$link = get_wp_user_avatar_src($id_or_email, 'original');
|
843 |
} elseif($link == 'attachment'){
|
844 |
// Get attachment URL
|
845 |
+
$link = get_attachment_link(get_the_author_meta($wpdb->get_blog_prefix($blog_id).'user_avatar', $id_or_email));
|
846 |
} else {
|
847 |
// URL
|
|
|
848 |
$link_class = 'custom';
|
849 |
}
|
850 |
+
// Open in new window
|
851 |
+
$target_link = !empty($target) ? ' target="'.$target.'"' : "";
|
852 |
// Wrap the avatar inside the link
|
853 |
+
$html = '<a href="'.$link.'" class="wp-user-avatar-link wp-user-avatar-'.$link_class.'"'.$target_link.'>'.get_wp_user_avatar($id_or_email, $get_size, $align).'</a>';
|
854 |
} else {
|
855 |
+
$html = get_wp_user_avatar($id_or_email, $get_size, $align);
|
856 |
+
}
|
857 |
+
// Check if caption is set
|
858 |
+
if(!empty($content)){
|
859 |
+
// Get attachment ID
|
860 |
+
$wpua = get_user_meta($id_or_email, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
|
861 |
+
// Clean up caption
|
862 |
+
$content = trim($content);
|
863 |
+
$content = preg_replace('/\r|\n/', "", $content);
|
864 |
+
$content = preg_replace('/<\/p><p>/', "", $content, 1);
|
865 |
+
$content = preg_replace('/<\/p><p>$/', "", $content);
|
866 |
+
$content = str_replace('</p><p>', "<br /><br />", $content);
|
867 |
+
$avatar = do_shortcode(image_add_caption($html, $wpua, $content, $title, $align, $link, $get_size, $alt));
|
868 |
+
} else {
|
869 |
+
$avatar = $html;
|
870 |
}
|
871 |
return $avatar;
|
872 |
}
|
903 |
$avatar_list .= '<br />';
|
904 |
}
|
905 |
// Show remove link if custom Default Avatar is set
|
906 |
+
if(!empty($wpua_avatar_default) && wp_attachment_is_image($wpua_avatar_default)){
|
907 |
$avatar_thumb_src = wp_get_attachment_image_src($wpua_avatar_default, array(32,32));
|
908 |
$avatar_thumb = $avatar_thumb_src[0];
|
909 |
$hide_remove = "";
|
920 |
$wpua_list .= preg_replace("/src='(.+?)'/", "src='\$1'", $avatar_thumb_img);
|
921 |
$wpua_list .= ' '.__('WP User Avatar', 'wp-user-avatar').'</label>';
|
922 |
$wpua_list .= '<p id="wpua-edit"><button type="button" class="button" id="wpua-add" name="wpua-add">'.__('Edit Image').'</button>';
|
923 |
+
$wpua_list .= '<span id="wpua-remove-button"'.$hide_remove.'><a href="#" id="wpua-remove">'.__('Remove').'</a></span><span id="wpua-undo-button"><a href="#" id="wpua-undo">'.__('Undo').'</a></span></p>';
|
924 |
$wpua_list .= '<input type="hidden" id="wp-user-avatar" name="avatar_default_wp_user_avatar" value="'.$wpua_avatar_default.'">';
|
925 |
$wpua_list .= '<p id="wpua-message">'.sprintf(__('Click %s to save your changes', 'wp-user-avatar'), '“'.__('Save Changes').'”').'</p>';
|
926 |
if((bool) $wpua_disable_gravatar != 1){
|
973 |
|
974 |
// Admin page
|
975 |
function wpua_options_page(){
|
976 |
+
global $show_avatars, $upload_size_limit_with_units, $wpua_allow_upload, $wpua_disable_gravatar, $wpua_edit_avatar, $wpua_resize_crop, $wpua_resize_h, $wpua_resize_upload, $wpua_resize_w, $wpua_tinymce, $wpua_upload_size_limit, $wpua_upload_size_limit_with_units;
|
977 |
// Give subscribers edit_posts capability
|
978 |
if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' && (empty($wpua_allow_upload) || empty($wpua_edit_avatar))){
|
979 |
wpua_subscriber_remove_cap();
|
980 |
}
|
981 |
+
$hide_size = (bool) $wpua_allow_upload != 1 ? ' style="display:none;"' : "";
|
982 |
+
$hide_resize = (bool) $wpua_resize_upload != 1 ? ' style="display:none;"' : "";
|
983 |
?>
|
984 |
<div class="wrap">
|
985 |
<?php screen_icon(); ?>
|
986 |
<h2><?php _e('WP User Avatar', 'wp-user-avatar'); ?></h2>
|
987 |
+
<form method="post" action="<?php echo admin_url('options.php'); ?>">
|
988 |
<?php settings_fields('wpua-settings-group'); ?>
|
989 |
<?php do_settings_fields('wpua-settings-group', ""); ?>
|
990 |
+
<?php do_action('wpua_donation_message'); ?>
|
991 |
<table class="form-table">
|
992 |
<tr valign="top">
|
993 |
<th scope="row"><?php _e('Settings'); ?></th>
|
998 |
<input name="wp_user_avatar_tinymce" type="checkbox" id="wp_user_avatar_tinymce" value="1" <?php checked($wpua_tinymce, 1); ?> />
|
999 |
<?php _e('Add avatar button to Visual Editor', 'wp-user-avatar'); ?>
|
1000 |
</label>
|
1001 |
+
</fieldset>
|
1002 |
+
<fieldset>
|
1003 |
<label for="wp_user_avatar_allow_upload">
|
1004 |
<input name="wp_user_avatar_allow_upload" type="checkbox" id="wp_user_avatar_allow_upload" value="1" <?php checked($wpua_allow_upload, 1); ?> />
|
1005 |
<?php _e('Allow Contributors & Subscribers to upload avatars', 'wp-user-avatar'); ?>
|
1006 |
</label>
|
1007 |
+
</fieldset>
|
1008 |
+
<fieldset>
|
1009 |
<label for="wp_user_avatar_disable_gravatar">
|
1010 |
<input name="wp_user_avatar_disable_gravatar" type="checkbox" id="wp_user_avatar_disable_gravatar" value="1" <?php checked($wpua_disable_gravatar, 1); ?> />
|
1011 |
<?php _e('Disable Gravatar and use only local avatars', 'wp-user-avatar'); ?>
|
1013 |
</fieldset>
|
1014 |
</td>
|
1015 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1016 |
</table>
|
1017 |
+
<div id="wpua-contributors-subscribers"<?php echo $hide_size; ?>>
|
1018 |
+
<table class="form-table">
|
1019 |
+
<tr valign="top">
|
1020 |
+
<th scope="row">
|
1021 |
+
<label for="wp_user_avatar_upload_size_limit">
|
1022 |
+
<?php _e('Upload Size Limit', 'wp-user-avatar'); ?> <?php _e('(only for Contributors & Subscribers)', 'wp-user-avatar'); ?>
|
1023 |
+
</label>
|
1024 |
+
</th>
|
1025 |
+
<td>
|
1026 |
+
<fieldset>
|
1027 |
+
<legend class="screen-reader-text"><span><?php _e('Upload Size Limit', 'wp-user-avatar'); ?> <?php _e('(only for Contributors & Subscribers)', 'wp-user-avatar'); ?></span></legend>
|
1028 |
+
<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" />
|
1029 |
+
<span id="wpua-readable-size"><?php echo $wpua_upload_size_limit_with_units; ?></span>
|
1030 |
+
<span id="wpua-readable-size-error"><?php printf(__('%s exceeds the maximum upload size for this site.'), ""); ?></span>
|
1031 |
+
<div id="wpua-slider"></div>
|
1032 |
+
<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>
|
1033 |
+
</fieldset>
|
1034 |
+
<fieldset>
|
1035 |
+
<label for="wp_user_avatar_edit_avatar">
|
1036 |
+
<input name="wp_user_avatar_edit_avatar" type="checkbox" id="wp_user_avatar_edit_avatar" value="1" <?php checked($wpua_edit_avatar, 1); ?> />
|
1037 |
+
<?php _e('Allow users to edit avatars', 'wp-user-avatar'); ?>
|
1038 |
+
</label>
|
1039 |
+
</fieldset>
|
1040 |
+
<fieldset>
|
1041 |
+
<label for="wp_user_avatar_resize_upload">
|
1042 |
+
<input name="wp_user_avatar_resize_upload" type="checkbox" id="wp_user_avatar_resize_upload" value="1" <?php checked($wpua_resize_upload, 1); ?> />
|
1043 |
+
<?php _e('Resize avatars on upload', 'wp-user-avatar'); ?>
|
1044 |
+
</label>
|
1045 |
+
</fieldset>
|
1046 |
+
<fieldset id="wpua-resize-sizes"<?php echo $hide_resize; ?>
|
1047 |
+
<br />
|
1048 |
+
<br />
|
1049 |
+
<label for="wp_user_avatar_resize_w"><?php _e('Width'); ?></label>
|
1050 |
+
<input name="wp_user_avatar_resize_w" type="number" step="1" min="0" id="wp_user_avatar_resize_w" value="<?php form_option('wp_user_avatar_resize_w'); ?>" class="small-text" />
|
1051 |
+
<label for="wp_user_avatar_resize_h"><?php _e('Height'); ?></label>
|
1052 |
+
<input name="wp_user_avatar_resize_h" type="number" step="1" min="0" id="wp_user_avatar_resize_h" value="<?php form_option('wp_user_avatar_resize_h'); ?>" class="small-text" />
|
1053 |
+
<br />
|
1054 |
+
<input name="wp_user_avatar_resize_crop" type="checkbox" id="wp_user_avatar_resize_crop" value="1" <?php checked('1', $wpua_resize_crop); ?> />
|
1055 |
+
<label for="wp_user_avatar_resize_crop"><?php _e('Crop avatars to exact dimensions', 'wp-user-avatar'); ?></label>
|
1056 |
+
</fieldset>
|
1057 |
+
</td>
|
1058 |
+
</tr>
|
1059 |
+
</table>
|
1060 |
+
</div>
|
1061 |
<h3 class="title"><?php _e('Avatars'); ?></h3>
|
1062 |
<p><?php _e('An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.'); ?></p>
|
1063 |
<table class="form-table">
|
1120 |
register_setting('wpua-settings-group', 'wp_user_avatar_allow_upload', 'intval');
|
1121 |
register_setting('wpua-settings-group', 'wp_user_avatar_disable_gravatar', 'intval');
|
1122 |
register_setting('wpua-settings-group', 'wp_user_avatar_edit_avatar', 'intval');
|
1123 |
+
register_setting('wpua-settings-group', 'wp_user_avatar_resize_crop', 'intval');
|
1124 |
+
register_setting('wpua-settings-group', 'wp_user_avatar_resize_h', 'intval');
|
1125 |
+
register_setting('wpua-settings-group', 'wp_user_avatar_resize_upload', 'intval');
|
1126 |
+
register_setting('wpua-settings-group', 'wp_user_avatar_resize_w', 'intval');
|
1127 |
register_setting('wpua-settings-group', 'wp_user_avatar_upload_size_limit', 'intval');
|
1128 |
}
|
1129 |
|
1140 |
}
|
1141 |
add_action('plugins_loaded', 'wpua_load');
|
1142 |
}
|
1143 |
+
|
1144 |
?>
|