Added Gravatar support! And it's really configurable too.
--- a/includes/comment.php Wed Jul 09 21:04:51 2008 -0400
+++ b/includes/comment.php Wed Jul 09 22:40:41 2008 -0400
@@ -98,7 +98,7 @@
{
$ret['template'] = file_get_contents(ENANO_ROOT . '/themes/' . $template->theme . '/comment.tpl');
}
- $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,( c.ip_address IS NOT NULL ) AS have_ip,u.user_level,u.user_id,u.signature,u.user_has_avatar,u.avatar_type, b.buddy_id IS NOT NULL AS is_buddy, ( b.is_friend IS NOT NULL AND b.is_friend=1 ) AS is_friend FROM '.table_prefix.'comments AS c
+ $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,( c.ip_address IS NOT NULL ) AS have_ip,u.user_level,u.user_id,u.email,u.signature,u.user_has_avatar,u.avatar_type, b.buddy_id IS NOT NULL AS is_buddy, ( b.is_friend IS NOT NULL AND b.is_friend=1 ) AS is_friend FROM '.table_prefix.'comments AS c
LEFT JOIN '.table_prefix.'users AS u
ON (u.user_id=c.user_id)
LEFT JOIN '.table_prefix.'buddies AS b
@@ -107,7 +107,7 @@
ON ( ( u.user_rank = r.rank_id ) )
WHERE page_id=\'' . $this->page_id . '\'
AND namespace=\'' . $this->namespace . '\'
- GROUP BY c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,c.ip_address,u.user_level,u.user_id,u.signature,u.user_has_avatar,u.avatar_type,b.buddy_id,b.is_friend
+ GROUP BY c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,c.ip_address,u.user_level,u.user_id,u.email,u.signature,u.user_has_avatar,u.avatar_type,b.buddy_id,b.is_friend
ORDER BY c.time ASC;');
$count_appr = 0;
$count_total = 0;
@@ -157,7 +157,7 @@
$row['have_ip'] = ( $row['have_ip'] == 1 );
// Avatar URL
- $row['avatar_path'] = make_avatar_url($row['user_id'], $row['avatar_type']);
+ $row['avatar_path'] = make_avatar_url($row['user_id'], $row['avatar_type'], $row['email']);
// Add the comment to the list
$ret['comments'][] = $row;
@@ -308,7 +308,7 @@
$db->die_json();
// Re-fetch
- $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.signature,u.user_has_avatar,u.avatar_type FROM '.table_prefix.'comments AS c
+ $q = $db->sql_query('SELECT c.comment_id,c.name,c.subject,c.comment_data,c.time,c.approved,u.user_level,u.user_id,u.email,u.signature,u.user_has_avatar,u.avatar_type FROM '.table_prefix.'comments AS c
LEFT JOIN '.table_prefix.'users AS u
ON (u.user_id=c.user_id)
WHERE page_id=\'' . $this->page_id . '\'
@@ -341,7 +341,7 @@
$ret['user_level_list']['member'] = USER_LEVEL_MEMBER;
$ret['user_level_list']['mod'] = USER_LEVEL_MOD;
$ret['user_level_list']['admin'] = USER_LEVEL_ADMIN;
- $ret['avatar_path'] = make_avatar_url($row['user_id'], $row['avatar_type']);
+ $ret['avatar_path'] = make_avatar_url($row['user_id'], $row['avatar_type'], $row['email']);
}
break;
--- a/includes/constants.php Wed Jul 09 21:04:51 2008 -0400
+++ b/includes/constants.php Wed Jul 09 22:40:41 2008 -0400
@@ -75,6 +75,7 @@
define('IMAGE_TYPE_PNG', 1);
define('IMAGE_TYPE_GIF', 2);
define('IMAGE_TYPE_JPG', 3);
+define('IMAGE_TYPE_GRV', 4);
// token types
define('TOKEN_VARIABLE', 1);
--- a/includes/functions.php Wed Jul 09 21:04:51 2008 -0400
+++ b/includes/functions.php Wed Jul 09 22:40:41 2008 -0400
@@ -4152,25 +4152,38 @@
* Generates a URL for the avatar for the given user ID and avatar type.
* @param int User ID
* @param string Image type - must be one of jpg, png, or gif.
+ * @param string User's e-mail address, makes Special:Avatar redirect if not specified
* @return string
*/
-function make_avatar_url($user_id, $avi_type)
+function make_avatar_url($user_id, $avi_type, $user_email = false)
{
static $img_types = array(
'png' => IMAGE_TYPE_PNG,
'gif' => IMAGE_TYPE_GIF,
- 'jpg' => IMAGE_TYPE_JPG
+ 'jpg' => IMAGE_TYPE_JPG,
+ 'grv' => IMAGE_TYPE_GRV
);
if ( !is_int($user_id) )
return false;
if ( !isset($img_types[$avi_type]) )
return false;
- $avi_relative_path = '/' . getConfig('avatar_directory') . '/' . $user_id . '.' . $avi_type;
- if ( !file_exists(ENANO_ROOT . $avi_relative_path) )
+
+ if ( $avi_type == 'grv' )
{
- return '';
+ if ( $user_email )
+ {
+ return make_gravatar_url($user_email);
+ }
+ }
+ else
+ {
+ $avi_relative_path = '/' . getConfig('avatar_directory') . '/' . $user_id . '.' . $avi_type;
+ if ( !file_exists(ENANO_ROOT . $avi_relative_path) )
+ {
+ return '';
+ }
}
$img_type = $img_types[$avi_type];
@@ -4184,6 +4197,39 @@
}
/**
+ * Generates a URL to the Gravatar for a user based on his/her e-mail address.
+ * @param string E-mail address
+ * @param int Size - defaults to site-wide limits
+ * @return string URL
+ */
+
+function make_gravatar_url($email, $size = false)
+{
+ $email = md5($email);
+
+ // gravatar parameters
+ if ( $size )
+ {
+ $max_size = intval($size);
+ }
+ else
+ {
+ $max_x = intval(getConfig('avatar_max_width', '150'));
+ $max_y = intval(getConfig('avatar_max_height', '150'));
+ // ?s=
+ $max_size = ( $max_x > $max_y ) ? $max_y : $max_x;
+ }
+
+ // ?r=
+ $rating = getConfig('gravatar_rating', 'g');
+
+ // final URL
+ $url = "http://www.gravatar.com/avatar/$email?r=$rating&s=$max_size";
+
+ return $url;
+}
+
+/**
* Determines an image's filetype based on its signature.
* @param string Path to image file
* @return string One of gif, png, or jpg, or false if none of these.
--- a/includes/pageprocess.php Wed Jul 09 21:04:51 2008 -0400
+++ b/includes/pageprocess.php Wed Jul 09 22:40:41 2008 -0400
@@ -1398,7 +1398,7 @@
echo '<tr><td class="row1" style="text-align: center;">';
if ( $userdata['user_has_avatar'] == '1' )
{
- echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $userdata['username'])) . '" src="' . make_avatar_url(intval($userdata['authoritative_uid']), $userdata['avatar_type']) . '" /><br />';
+ echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $userdata['username'])) . '" src="' . make_avatar_url(intval($userdata['authoritative_uid']), $userdata['avatar_type'], $userdata['email']) . '" /><br />';
}
// username
echo '<big><span style="' . $rank_data['rank_style'] . '">' . htmlspecialchars($target_username) . '</span></big><br />';
--- a/includes/pageutils.php Wed Jul 09 21:04:51 2008 -0400
+++ b/includes/pageutils.php Wed Jul 09 22:40:41 2008 -0400
@@ -641,7 +641,7 @@
if(!$e) $db->_die('The comment text data could not be selected.');
$num_app = $db->numrows();
$db->free_result();
- $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,c.ip_address,u.user_level,u.signature,u.user_has_avatar,u.avatar_type
+ $lq = $db->sql_query('SELECT c.comment_id,c.subject,c.name,c.comment_data,c.approved,c.time,c.user_id,c.ip_address,u.user_level,u.email,u.signature,u.user_has_avatar,u.avatar_type
FROM ' . table_prefix.'comments AS c
LEFT JOIN ' . table_prefix.'users AS u
ON c.user_id=u.user_id
@@ -765,7 +765,7 @@
{
$bool['user_has_avatar'] = true;
$strings['AVATAR_ALT'] = $lang->get('usercp_avatar_image_alt', array('username' => $row['name']));
- $strings['AVATAR_URL'] = make_avatar_url(intval($row['user_id']), $row['avatar_type']);
+ $strings['AVATAR_URL'] = make_avatar_url(intval($row['user_id']), $row['avatar_type'], $row['email']);
$strings['USERPAGE_LINK'] = makeUrlNS('User', $row['name']);
}
--- a/install/schemas/mysql_stage2.sql Wed Jul 09 21:04:51 2008 -0400
+++ b/install/schemas/mysql_stage2.sql Wed Jul 09 22:40:41 2008 -0400
@@ -108,7 +108,7 @@
user_coppa tinyint(1) NOT NULL DEFAULT 0,
user_lang smallint(5) NOT NULL DEFAULT 1,
user_has_avatar tinyint(1) NOT NULL DEFAULT 0,
- avatar_type ENUM('jpg', 'png', 'gif') NOT NULL DEFAULT 'png',
+ avatar_type ENUM('jpg', 'png', 'gif', 'grv') NOT NULL DEFAULT 'png',
user_registration_ip varchar(39),
user_rank int(12) UNSIGNED DEFAULT NULL,
user_timezone int(12) UNSIGNED NOT NULL DEFAULT 0,
--- a/install/schemas/postgresql_stage2.sql Wed Jul 09 21:04:51 2008 -0400
+++ b/install/schemas/postgresql_stage2.sql Wed Jul 09 22:40:41 2008 -0400
@@ -114,7 +114,7 @@
user_timezone int NOT NULL DEFAULT 0,
user_title varchar(64) DEFAULT NULL,
user_group int NOT NULL DEFAULT 1,
- CHECK (avatar_type IN ('jpg', 'png', 'gif')),
+ CHECK (avatar_type IN ('jpg', 'png', 'gif', 'grv')),
PRIMARY KEY (user_id)
);
--- a/install/schemas/upgrade/1.1.3-1.1.4-mysql.sql Wed Jul 09 21:04:51 2008 -0400
+++ b/install/schemas/upgrade/1.1.3-1.1.4-mysql.sql Wed Jul 09 22:40:41 2008 -0400
@@ -27,3 +27,6 @@
-- Disable JS effects column
ALTER TABLE {{TABLE_PREFIX}}users_extra ADD COLUMN disable_js_fx tinyint(1) NOT NULL DEFAULT 0;
+
+-- Add "grv" avatar type
+ALTER TABLE {{TABLE_PREFIX}}users MODIFY COLUMN avatar_type ENUM('png', 'gif', 'jpg', 'grv');
--- a/install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql Wed Jul 09 21:04:51 2008 -0400
+++ b/install/schemas/upgrade/1.1.3-1.1.4-postgresql.sql Wed Jul 09 22:40:41 2008 -0400
@@ -40,3 +40,6 @@
-- Disable JS effects column
ALTER TABLE {{TABLE_PREFIX}}users_extra ADD COLUMN disable_js_fx smallint NOT NULL DEFAULT 0;
+-- Add "grv" avatar type
+ALTER TABLE {{TABLE_PREFIX}}users DROP CONSTRAINT {{TABLE_PREFIX}}users_avatar_type_check;
+ALTER TABLE {{TABLE_PREFIX}}users ADD CONSTRAINT {{TABLE_PREFIX}}users_avatar_type_check CHECK ( avatar_type IN ( 'png', 'gif', 'jpg', 'grv' ) );
--- a/language/english/admin.json Wed Jul 09 21:04:51 2008 -0400
+++ b/language/english/admin.json Wed Jul 09 22:40:41 2008 -0400
@@ -327,6 +327,12 @@
field_avatar_upload_methods: 'Allowed upload methods:',
field_avatar_upload_file: 'Allow users to upload image files from their computers',
field_avatar_upload_http: 'Allow users to enter a URL to their desired avatar',
+ field_avatar_upload_gravatar: 'Allow users to use their <a href="http://www.gravatar.com/" onclick="window.open(this.href); return false;">Gravatar</a>',
+ field_avatar_gravatar_rating: 'Highest allowed rating for Gravatar images:',
+ field_avatar_gravatar_rating_g: 'G (no objectionable content)',
+ field_avatar_gravatar_rating_pg: 'PG (rude gestures, immodest dress, mild swearing/violence)',
+ field_avatar_gravatar_rating_r: 'R (profanity, violence, nudity, hard drug use)',
+ field_avatar_gravatar_rating_x: 'X (hardcore sexual images, extremely disturbing violence)',
field_avatar_directory: 'Avatar storage directory:',
field_avatar_directory_hint: 'This should be relative to your Enano root and should contain only alphanumeric characters and forward slashes, even if your server runs Windows.',
--- a/language/english/user.json Wed Jul 09 21:04:51 2008 -0400
+++ b/language/english/user.json Wed Jul 09 22:40:41 2008 -0400
@@ -331,6 +331,7 @@
avatar_lbl_remove: 'Delete my avatar',
avatar_lbl_set_http: 'Upload a new avatar from the Web',
avatar_lbl_set_file: 'Upload a new avatar from my computer',
+ avatar_lbl_set_gravatar: 'Use my Gravatar',
avatar_lbl_url: 'URL to image:',
avatar_lbl_url_desc: 'This must start with the <tt>http://</tt> prefix and must be a valid URL. The image will be copied from the existing URL to this server - dynamic avatars are not supported.',
avatar_lbl_file: 'Upload file:',
@@ -345,6 +346,12 @@
avatar_move_failed: 'Your image was accepted, but there was a problem moving the image file to the correct location.',
avatar_upload_success: 'Your avatar has been updated.',
avatar_file_too_large: 'The image you uploaded exceeds the maximum file size allowed for avatars on this site.',
+ avatar_gravatar_success: 'Your Gravatar will now be used as your avatar on this site.',
+ avatar_gravatar_rating_g: 'The highest allowed rating for your Gravatar image is <b>G</b>. Images must be suitable for display on all websites with any audience type.',
+ avatar_gravatar_rating_pg: 'The highest allowed rating for your Gravatar image is <b>PG</b>. Rude gestures, lesser swear words, mild violence, and mildly provocatively dressed individuals are permitted.',
+ avatar_gravatar_rating_r: 'The highest allowed rating for your Gravatar image is <b>R</b>. Nudity and violence must be tasteful.',
+ avatar_gravatar_rating_x: 'The highest allowed rating for your Gravatar image is <b>X</b>.',
+ avatar_link_gravatar_info: 'Learn about Gravatar',
// Password strength widget
pwstrength_score_verystrong: 'Very strong (score: %score%)',
--- a/plugins/SpecialAdmin.php Wed Jul 09 21:04:51 2008 -0400
+++ b/plugins/SpecialAdmin.php Wed Jul 09 22:40:41 2008 -0400
@@ -341,6 +341,11 @@
setConfig('avatar_enable_anim', ( isset($_POST['avatar_enable_anim']) ? '1' : '0' ));
setConfig('avatar_upload_file', ( isset($_POST['avatar_upload_file']) ? '1' : '0' ));
setConfig('avatar_upload_http', ( isset($_POST['avatar_upload_http']) ? '1' : '0' ));
+ setConfig('avatar_upload_gravatar', ( isset($_POST['avatar_upload_gravatar']) ? '1' : '0' ));
+ if ( in_array($_POST['gravatar_rating'], array('g', 'pg', 'r', 'x')) )
+ {
+ setConfig('gravatar_rating', $_POST['gravatar_rating']);
+ }
if ( is_dir(ENANO_ROOT . '/' . $_POST['avatar_directory']) )
{
@@ -497,22 +502,6 @@
</td>
</tr>
- <!-- Default permissions -->
-
- <!--
-
- READ: Do not try to enable this, backend support for it has been disabled. To edit default
- permissions, select The Entire Website in any permissions editor window.
-
- <tr><th colspan="2">Default permissions for pages</th></tr>
-
- <tr>
- <td class="row1">You can edit the default set of permissions used when no other permissions are available. Permissions set here are used when no other permissions are available. As with other ACL rules, you can assign these defaults to every user or one specific user or group.</td>
- <td class="row1"><a href="#" onclick="ajaxOpenACLManager('__DefaultPermissions', 'Special'); return false;">Manage default permissions</a></td>
- </tr>
-
- -->
-
<!-- Site disablement -->
<tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_disablesite'); ?></th></tr>
@@ -811,6 +800,40 @@
<input type="checkbox" name="avatar_upload_http" <?php if ( getConfig('avatar_upload_http') == '1' || getConfig('avatar_upload_http') === false ) echo 'checked="checked" '; ?>/>
<?php echo $lang->get('acpgc_field_avatar_upload_http'); ?>
</label>
+
+ <br />
+
+ <label>
+ <input type="checkbox" name="avatar_upload_gravatar" <?php if ( getConfig('avatar_upload_gravatar') == '1' || getConfig('avatar_upload_gravatar') === false ) echo 'checked="checked" '; ?>onclick="document.getElementById('acp_gravatar_rating').style.display = ( this.checked ) ? 'block' : 'none';" />
+ <?php echo $lang->get('acpgc_field_avatar_upload_gravatar'); ?>
+ </label>
+
+ <br />
+
+ <fieldset id="acp_gravatar_rating" style="margin-top: 10px; <?php if ( getConfig('avatar_upload_gravatar') === '0' ) echo ' display: none;'; ?>">
+
+ <?php /* The four ratings are g, pg, r, and x - loop through each and output a localized string and a radiobutton */ ?>
+ <legend><?php echo $lang->get('acpgc_field_avatar_gravatar_rating'); ?></legend>
+
+ <?php foreach ( array('g', 'pg', 'r', 'x') as $rating ): ?>
+
+ <label>
+
+ <input type="radio" name="gravatar_rating" value="<?php echo $rating; ?>"<?php
+ // Check the button if this is the current selection *or* if we're on "G" and the current configuration value is unset
+ if ( getConfig('gravatar_rating', 'g') == $rating )
+ echo ' checked="checked"';
+ ?> />
+
+ <?php /* The localized string */ ?>
+ <?php echo $lang->get("acpgc_field_avatar_gravatar_rating_$rating"); ?>
+
+ </label>
+
+ <br />
+
+ <?php endforeach; ?>
+ </fieldset>
</td>
</tr>
--- a/plugins/SpecialUserFuncs.php Wed Jul 09 21:04:51 2008 -0400
+++ b/plugins/SpecialUserFuncs.php Wed Jul 09 22:40:41 2008 -0400
@@ -2079,7 +2079,8 @@
$img_types = array(
IMAGE_TYPE_PNG => 'png',
IMAGE_TYPE_GIF => 'gif',
- IMAGE_TYPE_JPG => 'jpg'
+ IMAGE_TYPE_JPG => 'jpg',
+ IMAGE_TYPE_GRV => 'grv'
);
$avi_id = $paths->getParam(0);
@@ -2106,6 +2107,31 @@
// build file path
$avi_type = $img_types[$avi_id_dec['img_type']];
+
+ // is this a gravatar?
+ if ( $avi_type == 'grv' )
+ {
+ // yes, we'll have to redirect
+ // sanitize UID
+ $uid = intval($avi_id_dec['uid']);
+
+ // fetch email
+ $q = $db->sql_query('SELECT email FROM ' . table_prefix . "users WHERE user_id = $uid;");
+ if ( !$q )
+ $db->_die();
+ if ( $db->numrows() < 1 )
+ return false;
+
+ list($email) = $db->fetchrow_num();
+ $db->free_result();
+
+ $url = make_gravatar_url($url);
+
+ // ship out the redirect
+ header('HTTP/1.1 302 Permanent Redirect');
+ header("Location: $url");
+ }
+
$avi_path = ENANO_ROOT . '/' . getConfig('avatar_directory') . '/' . $avi_id_dec['uid'] . '.' . $avi_type;
if ( file_exists($avi_path) )
{
--- a/plugins/SpecialUserPrefs.php Wed Jul 09 21:04:51 2008 -0400
+++ b/plugins/SpecialUserPrefs.php Wed Jul 09 22:40:41 2008 -0400
@@ -896,6 +896,32 @@
echo '<div class="error-box">' . $lang->get('usercp_avatar_move_failed') . '</div>';
}
break;
+ case 'set_gravatar':
+ // set avatar to use Gravatar
+ // make sure we're allowed to do this
+ if ( getConfig('avatar_upload_gravatar') != '1' )
+ {
+ // access denied
+ break;
+ }
+ // first, remove old image
+ if ( $has_avi )
+ {
+ // First switch the avatar off
+ $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 0 WHERE user_id = ' . $session->user_id . ';');
+ if ( !$q )
+ $db->_die('Avatar CP switching user avatar off');
+
+ @unlink($avi_path);
+ }
+ // set to gravatar mode
+ $q = $db->sql_query('UPDATE ' . table_prefix . 'users SET user_has_avatar = 1, avatar_type = \'grv\' WHERE user_id = ' . $session->user_id . ';');
+ if ( !$q )
+ $db->_die('Avatar CP switching user avatar off');
+
+ $has_avi = 1;
+ echo '<div class="info-box">' . $lang->get('usercp_avatar_gravatar_success') . '</div>';
+ break;
}
}
@@ -910,14 +936,22 @@
case 'remove':
$('avatar_upload_http').object.style.display = 'none';
$('avatar_upload_file').object.style.display = 'none';
+ $('avatar_upload_gravatar').object.style.display = 'none';
break;
case 'set_http':
$('avatar_upload_http').object.style.display = 'block';
$('avatar_upload_file').object.style.display = 'none';
+ $('avatar_upload_gravatar').object.style.display = 'none';
break;
case 'set_file':
$('avatar_upload_http').object.style.display = 'none';
$('avatar_upload_file').object.style.display = 'block';
+ $('avatar_upload_gravatar').object.style.display = 'none';
+ break;
+ case 'set_gravatar':
+ $('avatar_upload_gravatar').object.style.display = 'block';
+ $('avatar_upload_http').object.style.display = 'none';
+ $('avatar_upload_file').object.style.display = 'none';
break;
}
}
@@ -942,7 +976,7 @@
if ( $has_avi == 1 )
{
- echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $session->username)) . '" src="' . make_avatar_url($session->user_id, $avi_type) . '" />';
+ echo '<img alt="' . $lang->get('usercp_avatar_image_alt', array('username' => $session->username)) . '" src="' . make_avatar_url($session->user_id, $avi_type, $session->email) . '" />';
}
else
{
@@ -973,7 +1007,7 @@
}
if ( getConfig('avatar_upload_file') == '1' )
{
- echo ' <label><input type="radio" name="avatar_action" value="set_file" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_file') . '</label>
+ echo ' <label><input type="radio" name="avatar_action" value="set_file" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_file') . '</label><br />
<div id="avatar_upload_file" style="display: none; margin: 10px 0 0 2.2em;">
' . $lang->get('usercp_avatar_lbl_file') . ' <input type="file" name="avatar_file" size="40" /><br />
<small>' . $lang->get('usercp_avatar_lbl_file_desc') . ' ' . $lang->get('usercp_avatar_limits') . '</small>
@@ -983,6 +1017,24 @@
{
echo ' <div id="avatar_upload_file" style="display: none;"></div>';
}
+ if ( getConfig('avatar_upload_gravatar') == '1' )
+ {
+ $rating_images = array('g' => '0', 'pg' => '1', 'r' => '2', 'x' => '3');
+ $rating_id = $rating_images[ getConfig('gravatar_rating', 'g') ];
+ $rating_image = "http://s.gravatar.com/images/gravatars/ratings/$rating_id.gif";
+ $max_rating = getConfig('gravatar_rating', 'g');
+ echo ' <label><input type="radio" name="avatar_action" value="set_gravatar" onclick="avatar_select_field(this);" /> ' . $lang->get('usercp_avatar_lbl_set_gravatar') . ' <img alt=" " src="' . make_gravatar_url($session->email, 16) . '" /></label> (<a href="http://www.gravatar.com/" onclick="window.open(this); return false;">' . $lang->get('usercp_avatar_link_gravatar_info') . '</a>)
+ <div id="avatar_upload_gravatar" style="display: none; margin: 10px 0 0 2.2em;">
+ <div style="float: left; margin-right: 5px; margin-bottom: 20px;">
+ <img alt=" " src="' . $rating_image . '" />
+ </div>
+ ' . $lang->get("usercp_avatar_gravatar_rating_$max_rating") . '
+ </div>';
+ }
+ else
+ {
+ echo ' <div id="avatar_upload_gravatar" style="display: none;"></div>';
+ }
echo ' </td>
</tr>';
--- a/plugins/admin/UserManager.php Wed Jul 09 21:04:51 2008 -0400
+++ b/plugins/admin/UserManager.php Wed Jul 09 22:40:41 2008 -0400
@@ -1226,7 +1226,7 @@
{
$parser->assign_vars(array(
'AVATAR_SRC' => make_avatar_url($this->user_id, $this->avi_type),
- 'AVATAR_ALT' => $lang->get('usercp_avatar_image_alt', array('username' => $this->username))
+ 'AVATAR_ALT' => $lang->get('usercp_avatar_image_alt', array('username' => $this->username), $this->email)
));
}