Gravatar. Change your options here. As of version 2.2 there is also a widget for Recent Comments with Gravatars.
Version: 2.5
Author: Rune Gulbrandsøy
Author URI: http://bloggs.be/wpmu/gravatar/
*/
/*
Copyright 2007 Rune (http://bloggs.be/rune/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
The idea for the Favicon parts come from the plugin favatars by Jeff Minard (http://thecodepro.com/). I have used some of his codem and rewritten some of the parts i have used.
Thanks to Petter (http://neppe.no) for the tips about a nofollow option!
*/
function gravatar_admin_menu(){
add_submenu_page('themes.php', 'Gravatar', 'Gravatar', 8, 'gravatar', 'gravatar_admin');
}
function show_gravatar($s) {
$gravatar = get_option('bruk_gravatar');
$gravatar_align = get_option('bruk_gravatar_align');
$default = get_option('default_gravatar');
$gravatar_use_url = get_option('bruk_gravatar_url');
$gravatar_use_url_follow = get_option('bruk_gravatar_url_follow');
$home_url = get_option('bruk_gravatar_home_url');
$use_favico = get_option('bruk_gravatar_favico');
$use_mbl = get_option('bruk_mbl_ikon');
if($gravatar == true){
global $comment;
$comment_tekst = $comment->get_comment_text;
if ( !empty( $comment->comment_author_email ) ) {
$lowercase = strtolower($comment->comment_author_email);
$md5 = md5( $lowercase );
//$default == $default_gravatar;
$comment_name = $comment->comment_author;
if ( $comment->comment_author_url == 'http://' || $comment->comment_author_url == '') {
$comment_link = get_option('home');
}else{
$comment_link = $comment->comment_author_url;
if ($use_favico == true){
$favicon_url = getFavicon($comment_link);
$default = $favicon_url;
if ($default == '')
$default = get_option('default_gravatar');
}
}
if ($use_mbl == true && $default == get_option('default_gravatar')){
$default = "http://pub.mybloglog.com/coiserv.php?href=mailto:" . $lowercase . "&n=". $lowercase;
}
//edit the style to what you want, the standard style looks good on most themes.
if($gravatar_use_url_follow == true){
$follow_links = "rel='external nofollow'";
} else {
$follow_links = "rel='external'";
}
if($gravatar_align == true){
if($home_url == true && $comment_link != get_option('home')){
$s = "$comment_name";
} else {
if ($gravatar_use_url == true){
$s = "$comment_name
";
}else{
$s = "$comment_name
";
}}
}else{
if($home_url == true && $comment_link != get_option('home')){
$s = "$comment_name
";
} else {
if ($gravatar_use_url == true){
$s = "$comment_name
";
}else{
$s = "$comment_name
";
}}
}}
return $s;
}
return $s;
}
function show_gravatar_post($s) {
$gravatar = get_option('bruk_gravatar');
$gravatar_align = get_option('bruk_gravatar_align');
$default = get_option('default_gravatar');
$post_gravatar = get_option('bruk_gravatar_post');
//$s = "Dette skal ikke komme";
if($post_gravatar == true){
global $post;
$epost = get_the_author_email();
$lowercase = strtolower($epost);
$md5 = md5($lowercase);
$content=$s;
$s= "
";
$s=$s."$content";
}
return $s;
}
function gravatar_admin(){
global $userdata;
get_currentuserinfo();
$current_user = $userdata->ID;
$default_gravatar = get_option('default_gravatar');
if ($default_gravatar != '') {
$default_gravatar_temp = $default_gravatar;
}else{
$default_gravatar_temp = "http://use.perl.org/images/pix.gif";
}
$gravatar = get_option('bruk_gravatar');
$gravatar_align = get_option('bruk_gravatar_align');
$gravatar_profil = get_option('bruk_gravatar_profil');
$gravatar_url = get_option('bruk_gravatar_url');
$gravatar_url_follow = get_option('bruk_gravatar_url_follow');
$gravatar_home_url = get_option('bruk_gravatar_home_url');
$gravatar_favico = get_option('bruk_gravatar_favico');
$gravatar_uid = get_option('bruk_gravatar_uid');
$gravatar_post = get_option('bruk_gravatar_post');
$use_mbl = get_option('bruk_mbl_ikon');
if ($gravatar_uid != ' '){
$temp_uid = $gravatar_uid;
}else{
$temp_uid = '1';
}
$version = "2.5";
if ($_POST['updatinggravatar']) {
$temp_grav = $_POST['defaultgravataroption'];
if ($_POST['bruke_gravatar']) {
$gravatar = true;
} else {
$gravatar = false;
}
if ($_POST['bruke_gravatar_align']){
$gravatar_align = true;
} else {
$gravatar_align = false;
}
if ($_POST['bruke_gravatar_profil']){
$gravatar_profil = true;
} else {
$gravatar_profil = false;
}
if ($_POST['bruk_gravatar_post']){
$gravatar_post = true;
} else {
$gravatar_post = false;
}
if ($_POST['bruk_gravatar_url']){
$gravatar_url = true;
} else {
$gravatar_url = false;
}
if ($_POST['bruk_gravatar_url_follow']){
$gravatar_url_follow = true;
} else {
$gravatar_url_follow = false;
}
if ($_POST['bruk_gravatar_home_url']){
$gravatar_home_url = true;
} else {
$gravatar_home_url = false;
}
if ($_POST['bruk_gravatar_favico']){
$gravatar_favico = true;
} else {
$gravatar_favico = false;
}
if ($_POST['bruk_mbl_ikon']){
$use_mbl = true;
} else {
$use_mbl = false;
}
if ($_POST['default_gravatar']){
$default_gravatar = $_POST['default_gravatar'];
}
if ($_POST['bruk_gravatar_uid']){
$gravatar_uid = $_POST['bruk_gravatar_uid'];
}
update_option('bruk_gravatar', $gravatar);
update_option('bruk_gravatar_align', $gravatar_align);
update_option('bruk_gravatar_profil', $gravatar_profil);
update_option('bruk_gravatar_post', $gravatar_post);
update_option('bruk_gravatar_url', $gravatar_url);
update_option('bruk_gravatar_url_follow', $gravatar_url_follow);
update_option('bruk_gravatar_home_url', $gravatar_home_url);
update_option('bruk_gravatar_favico', $gravatar_favico);
update_option('default_gravatar', $default_gravatar);
update_option('bruk_gravatar_uid', $gravatar_uid);
update_option('bruk_mbl_ikon', $use_mbl);
echo '
Your choices has been updated
320, 'height' => 90); $class = array('classname' => 'widget_recent_comments_gravatars'); wp_register_sidebar_widget('recent-comments_gravatars', __('Recent Comments Gravatars'), 'widget_recent_comments_gravatars', $class); wp_register_widget_control('recent-comments_gravatars', __('Recent Comments Gravatars'), 'widget_recent_comments_control_gravatars', $dims); } if ( is_active_widget('widget_recent_comments_gravatars') ) add_action('wp_head', 'widget_recent_comments_style_gravatars'); } // End of widget for Recent Comments with Gravatars //Trying to use favico.ico if no Gravatar exists and the user has lef an URL to use function comment_favicon($before='