Skip to content

Commit

Permalink
Made the use of gravatar optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Juraci Paixão Kröhling committed Oct 22, 2013
1 parent 9c030a6 commit 97f92b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,6 +4,7 @@
*.swp
*.graffle
.idea
*.iml

# Useful files which should never be committed
src/configs/override.ini
Expand Down
1 change: 1 addition & 0 deletions src/configs/defaults.ini
Expand Up @@ -20,6 +20,7 @@ assetProtocol=""
displaySignupLink=""
displaySignupUrl=""
enableBetaFeatures="0"
useGravatar=1

[secrets]
passwordSalt="salt_for_passwords"
Expand Down
6 changes: 5 additions & 1 deletion src/libraries/models/User.php
Expand Up @@ -95,8 +95,12 @@ public function getAvatarFromEmail($size = 50, $email = null)

$defaultUrl = sprintf('%s%s', $hostAndProtocol, $this->themeObj->asset('image', 'profile-default.png', false));

if ($this->config->site->useGravatar == 0)
return $defaultUrl;

$hash = md5(strtolower(trim($email)));
return sprintf("http://www.gravatar.com/avatar/%s?s=%s&d=%s", $hash, $size, urlencode($defaultUrl));
// return without the protocol part, so that we use the same protocol as it's currently being served
return sprintf("//www.gravatar.com/avatar/%s?s=%s&d=%s", $hash, $size, urlencode($defaultUrl));
}

/**
Expand Down

0 comments on commit 97f92b5

Please sign in to comment.