Simple Local Avatars - Version 1.1

Version Description

  • All users (regardless of capabilities) can upload avatars by default. To limit avatar uploading to users with upload files capabilities (Authors and above), check the applicable option under Settings > Discussion. This was the default behavior in 1.0.
  • Localization support; German included
Download this release

Release Info

Developer jakemgold
Plugin Icon 128x128 Simple Local Avatars
Version 1.1
Comparing to
See all releases

Code changes from version 1.0 to 1.1

localization/simple-local-avatars-de_DE.mo ADDED
Binary file
localization/simple-local-avatars-de_DE.po ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Simple Local Avatars
2
+ # This file is distributed under the same license as the Simple Local Avatars package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Simple Local Avatars 1.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-local-avatars\n"
7
+ "POT-Creation-Date: 2011-01-18 16:36:12+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2011-01-18 14:17-0500\n"
12
+ "Last-Translator: Jake Goldman <jakemgold@emailgroups.net>\n"
13
+ "Language-Team: \n"
14
+ "X-Poedit-Language: German\n"
15
+
16
+ #: simple-local-avatars.php:104
17
+ msgid "Local Avatar Permissions"
18
+ msgstr "Profilbild-Berechtigungen"
19
+
20
+ #: simple-local-avatars.php:120
21
+ msgid "Only allow users with file upload capabilities to upload local avatars (Authors and above)"
22
+ msgstr "Erlaube ausschließlich Benutzern mit der Berechtigung zum Bearbeiten von Dateien das Hochladen von Profilbildern (Autoren und darüber)"
23
+
24
+ #: simple-local-avatars.php:128
25
+ msgid "Avatar"
26
+ msgstr "Profilbild"
27
+
28
+ #: simple-local-avatars.php:132
29
+ msgid "Upload Avatar"
30
+ msgstr "Profilbild hochladen"
31
+
32
+ #: simple-local-avatars.php:148
33
+ msgid "No local avatar is set. Use the upload field to add a local avatar."
34
+ msgstr "Es ist kein Profilbild festgelegt. Klicke „Durchsuchen…“, um ein Profilbild hochzuladen."
35
+
36
+ #: simple-local-avatars.php:151
37
+ msgid "Delete local avatar"
38
+ msgstr "Profilbild löschen"
39
+
40
+ #: simple-local-avatars.php:152
41
+ msgid "Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option."
42
+ msgstr "Ersetze das Profilbild, indem du ein neues hochlädst, oder lösche das Profilbild (dann wird ggf. dein Gravatar angezeigt), indem du „Profilbild löschen“ auswählst."
43
+
44
+ #: simple-local-avatars.php:158
45
+ msgid "No local avatar is set. Set up your avatar at Gravatar.com."
46
+ msgstr "Es ist kein Profilbild festgelegt. Lade dein Profilbild bei Gravatar.com hoch."
47
+
48
+ #: simple-local-avatars.php:161
49
+ msgid "You do not have media management permissions. To change your local avatar, contact the blog administrator."
50
+ msgstr "Du hast keine Berechtigung zur Bearbeitung von Mediadateien. Um dein Profilbild zu ändern, kontaktiere den Administrator dieser Website."
51
+
52
+ #. Plugin Name of the plugin/theme
53
+ msgid "Simple Local Avatars"
54
+ msgstr "Simple Local Avatars (Einfache lokale Profilbilder)"
55
+
56
+ #. Description of the plugin/theme
57
+ msgid "Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight."
58
+ msgstr "Fügt ein Feld zum Hochladen eines Profilbilds (Avatar) hinzu, sofern der Benutzer zum Bearbeiten von Mediadateien berechtigt ist. Generiert die erforderlichen Maße, genau wie Gravatar! Einfach und schlank."
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.thinkoomph.com/plugins-modules/wordpress-simple-local-av
4
  Tags: avatar, gravatar, user photos, users, profile
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
- Stable tag: 1.0
8
 
9
  Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar!
10
 
@@ -20,15 +20,21 @@ Unlike other avatar plug-ins, Simple Local Avatars:
20
  1. Has a simple, native interface
21
  1. Fully supports Gravatar and default avatars if no local avatar is set for the user
22
  1. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
23
-
24
 
25
  == Installation ==
26
 
27
  1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the extracted folder to the `/wp-content/plugins/` directory
28
  1. Activate the plugin through the 'Plugins' menu in WordPress
 
29
  1. Start uploading avatars by editing user profiles!
30
 
31
-
32
  == Screenshots ==
33
 
34
- 1. Avatar upload field on a user profile page
 
 
 
 
 
 
4
  Tags: avatar, gravatar, user photos, users, profile
5
  Requires at least: 3.0
6
  Tested up to: 3.1
7
+ Stable tag: 1.1
8
 
9
  Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar!
10
 
20
  1. Has a simple, native interface
21
  1. Fully supports Gravatar and default avatars if no local avatar is set for the user
22
  1. Generates the requested avatar size on demand (and stores the new size for efficiency), so it looks great, just like Gravatar!
23
+ 1. Let's you decide whether lower privilege users (subscribers, contributors) can upload their own avatar
24
 
25
  == Installation ==
26
 
27
  1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the extracted folder to the `/wp-content/plugins/` directory
28
  1. Activate the plugin through the 'Plugins' menu in WordPress
29
+ 1. If you only want users with file upload capabilities to upload avatars, check the applicable option under Settings > Discussion
30
  1. Start uploading avatars by editing user profiles!
31
 
 
32
  == Screenshots ==
33
 
34
+ 1. Avatar upload field on a user profile page
35
+
36
+ == Changelog ==
37
+
38
+ = 1.1 =
39
+ * All users (regardless of capabilities) can upload avatars by default. To limit avatar uploading to users with upload files capabilities (Authors and above), check the applicable option under Settings > Discussion. This was the default behavior in 1.0.
40
+ * Localization support; German included
simple-local-avatars.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple Local Avatars
4
  Plugin URI: http://www.thinkoomph.com/plugins-modules/wordpress-simple-local-avatars/
5
  Description: Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight.
6
- Version: 1.0
7
  Author: Jake Goldman (Oomph, Inc)
8
  Author URI: http://www.thinkoomph.com
9
 
@@ -34,6 +34,8 @@ class simple_local_avatars
34
  {
35
  add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 5 );
36
 
 
 
37
  add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
38
  add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
39
 
@@ -94,20 +96,48 @@ class simple_local_avatars
94
  return $avatar;
95
  }
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  function edit_user_profile( $profileuser )
98
  {
99
  ?>
100
- <h3><?php _e( 'Avatar' ); ?></h3>
101
 
102
  <table class="form-table">
103
  <tr>
104
- <th><label for="simple-local-avatar"><?php _e('Upload Avatar'); ?></label></th>
105
  <td style="width: 50px;" valign="top">
106
  <?php echo get_avatar( $profileuser->ID ); ?>
107
  </td>
108
  <td>
109
  <?php
110
- if ( current_user_can('upload_files') )
 
 
111
  {
112
  do_action( 'simple_local_avatar_notices' );
113
  wp_nonce_field( 'simple_local_avatar_nonce', '_simple_local_avatar_nonce', false );
@@ -115,20 +145,20 @@ class simple_local_avatars
115
  <input type="file" name="simple-local-avatar" id="simple-local-avatar" /><br />
116
  <?php
117
  if ( !isset( $profileuser->simple_local_avatar ) || empty( $profileuser->simple_local_avatar ) )
118
- echo '<span class="description">' . __('No local avatar is set. Use the upload field to add a local avatar.') . '</span>';
119
  else
120
  echo '
121
- <input type="checkbox" name="simple-local-avatar-erase" value="1" /> ' . __('Delete local avatar') . '<br />
122
- <span class="description">' . __('Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option.') . '</span>
123
  ';
124
  }
125
  else
126
  {
127
  if ( !isset( $profileuser->simple_local_avatar ) || empty( $profileuser->simple_local_avatar ) )
128
- echo '<span class="description">' . __('No local avatar is set. Set up your avatar at Gravatar.com.') . '</span>';
129
  else
130
  echo '
131
- <span class="description">' . __('You do not have media management permissions. To change your local avatar, contact the blog administrator.') . '</span>
132
  ';
133
  }
134
  ?>
@@ -147,7 +177,7 @@ class simple_local_avatars
147
 
148
  function edit_user_profile_update( $user_id )
149
  {
150
- if ( !wp_verify_nonce( $_POST['_simple_local_avatar_nonce'], 'simple_local_avatar_nonce' ) || !current_user_can('upload_files') ) //security
151
  return;
152
 
153
  if ( !empty( $_FILES['simple-local-avatar']['name'] ) )
@@ -167,10 +197,10 @@ class simple_local_avatars
167
  switch ( $avatar['error'] )
168
  {
169
  case 'File type does not meet security guidelines. Try another.' :
170
- add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error",__("Please upload a valid image file for the avatar."));') );
171
  break;
172
  default :
173
- add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error","<strong>".__("There was an error uploading the avatar:")."</strong> ' . esc_attr( $avatar['error'] ) . '");') );
174
  }
175
 
176
  return;
@@ -267,4 +297,6 @@ function simple_local_avatars_uninstall()
267
  delete_user_meta( $user->$user_id, 'simple_local_avatar' );
268
  }
269
  }
 
 
270
  }
3
  Plugin Name: Simple Local Avatars
4
  Plugin URI: http://www.thinkoomph.com/plugins-modules/wordpress-simple-local-avatars/
5
  Description: Adds an avatar upload field to user profiles if the current user has media permissions. Generates requested sizes on demand just like Gravatar! Simple and lightweight.
6
+ Version: 1.1
7
  Author: Jake Goldman (Oomph, Inc)
8
  Author URI: http://www.thinkoomph.com
9
 
34
  {
35
  add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 5 );
36
 
37
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
38
+
39
  add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
40
  add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
41
 
96
  return $avatar;
97
  }
98
 
99
+ function admin_init()
100
+ {
101
+ load_plugin_textdomain( 'simple-local-avatars', false, dirname( plugin_basename( __FILE__ ) ) . '/localization/' );
102
+
103
+ register_setting( 'discussion', 'simple_local_avatars_caps', array( $this, 'sanitize_options' ) );
104
+ add_settings_field( 'simple-local-avatars-caps', __('Local Avatar Permissions','simple-local-avatars'), array( $this, 'avatar_settings_field' ), 'discussion', 'avatars' );
105
+ }
106
+
107
+ function sanitize_options( $input )
108
+ {
109
+ $new_input['simple_local_avatars_caps'] = ( isset($input['simple_local_avatars_caps']) && !empty($input['simple_local_avatars_caps']) ) ? 1 : 0;
110
+ return $new_input;
111
+ }
112
+
113
+ function avatar_settings_field( $args )
114
+ {
115
+ $options = get_option('simple_local_avatars_caps');
116
+
117
+ echo '
118
+ <label for="simple_local_avatars_caps">
119
+ <input type="checkbox" name="simple_local_avatars_caps" id="simple_local_avatars_caps" value="1" ' . @checked( $options['simple_local_avatars_caps'], 1, false ) . ' />
120
+ ' . __('Only allow users with file upload capabilities to upload local avatars (Authors and above)','simple-local-avatars') . '
121
+ </label>
122
+ ';
123
+ }
124
+
125
  function edit_user_profile( $profileuser )
126
  {
127
  ?>
128
+ <h3><?php _e( 'Avatar','simple-local-avatars' ); ?></h3>
129
 
130
  <table class="form-table">
131
  <tr>
132
+ <th><label for="simple-local-avatar"><?php _e('Upload Avatar','simple-local-avatars'); ?></label></th>
133
  <td style="width: 50px;" valign="top">
134
  <?php echo get_avatar( $profileuser->ID ); ?>
135
  </td>
136
  <td>
137
  <?php
138
+ $options = get_option('simple_local_avatars_caps');
139
+
140
+ if ( !isset($options['simple_local_avatars_caps']) || empty($options['simple_local_avatars_caps']) || current_user_can('upload_files') )
141
  {
142
  do_action( 'simple_local_avatar_notices' );
143
  wp_nonce_field( 'simple_local_avatar_nonce', '_simple_local_avatar_nonce', false );
145
  <input type="file" name="simple-local-avatar" id="simple-local-avatar" /><br />
146
  <?php
147
  if ( !isset( $profileuser->simple_local_avatar ) || empty( $profileuser->simple_local_avatar ) )
148
+ echo '<span class="description">' . __('No local avatar is set. Use the upload field to add a local avatar.','simple-local-avatars') . '</span>';
149
  else
150
  echo '
151
+ <input type="checkbox" name="simple-local-avatar-erase" value="1" /> ' . __('Delete local avatar','simple-local-avatars') . '<br />
152
+ <span class="description">' . __('Replace the local avatar by uploading a new avatar, or erase the local avatar (falling back to a gravatar) by checking the delete option.','simple-local-avatars') . '</span>
153
  ';
154
  }
155
  else
156
  {
157
  if ( !isset( $profileuser->simple_local_avatar ) || empty( $profileuser->simple_local_avatar ) )
158
+ echo '<span class="description">' . __('No local avatar is set. Set up your avatar at Gravatar.com.','simple-local-avatars') . '</span>';
159
  else
160
  echo '
161
+ <span class="description">' . __('You do not have media management permissions. To change your local avatar, contact the blog administrator.','simple-local-avatars') . '</span>
162
  ';
163
  }
164
  ?>
177
 
178
  function edit_user_profile_update( $user_id )
179
  {
180
+ if ( !wp_verify_nonce( $_POST['_simple_local_avatar_nonce'], 'simple_local_avatar_nonce' ) ) //security
181
  return;
182
 
183
  if ( !empty( $_FILES['simple-local-avatar']['name'] ) )
197
  switch ( $avatar['error'] )
198
  {
199
  case 'File type does not meet security guidelines. Try another.' :
200
+ add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error",__("Please upload a valid image file for the avatar.","simple-local-avatars"));') );
201
  break;
202
  default :
203
+ add_action( 'user_profile_update_errors', create_function('$a','$a->add("avatar_error","<strong>".__("There was an error uploading the avatar:","simple-local-avatars")."</strong> ' . esc_attr( $avatar['error'] ) . '");') );
204
  }
205
 
206
  return;
297
  delete_user_meta( $user->$user_id, 'simple_local_avatar' );
298
  }
299
  }
300
+
301
+ delete_option('simple_local_avatars_caps');
302
  }