Feature #6481
openGravatars: Add option to force default avatar display
0%
Description
We would like to see an admin option to force the display of the default gravatar icon.
This can be implemented very easily be adding the following parameter to the gravatar url: &forcedefault=1
Now If I choose for example wavatar as the default gravatar icon in the display options, and then check this new "force" option, the above url parameter will be appended to the url, resulting in the display of the wavatar wven if the user uploaded a picture in gravatar.
This way offensive/annoying custom gravatars can be avioded.
Updated by Felix Schäfer about 14 years ago
- Assignee set to Felix Schäfer
I'll try to have a look at this tonight, the patch probably won't make it to 1.0.2 though.
Updated by Felix Schäfer about 14 years ago
I couldn't find any mention of that in the API docs, and we won't support unofficial APIs where we can avoid it.
Updated by Eric Davis about 14 years ago
If it's in the official Gravatar API we can use it. Redmine is using my fork of the Gravatar plugin already so we can add features to it that we need.
Updated by Felix Schäfer about 14 years ago
Eric Davis wrote:
If it's in the official Gravatar API we can use it.
As I said, can't find it mentioned here http://en.gravatar.com/site/implement/images/
Redmine is using my fork of the Gravatar plugin already so we can add features to it that we need.
I know :-)
Updated by Sebastian M. about 14 years ago
I asked the gravatar devs to add it to the official api.
Meanwhile, could you tell me wich line I have to edit to add that parameter in the sourcecode?
Updated by Felix Schäfer about 14 years ago
Sebastian M. wrote:
I asked the gravatar devs to add it to the official api.
Please update this ticket once they have, I'll take care of adding the feature.
Meanwhile, could you tell me wich line I have to edit to add that parameter in the sourcecode?
Here's a diff that should (i.e. non-tested) work:
diff --git a/vendor/plugins/gravatar/lib/gravatar.rb b/vendor/plugins/gravatar/lib/gravatar.rb
index 9af1fed..43e2c9e 100644
--- a/vendor/plugins/gravatar/lib/gravatar.rb
+++ b/vendor/plugins/gravatar/lib/gravatar.rb
@@ -35,6 +35,9 @@ module GravatarHelper
# Whether or not to display the gravatars using HTTPS instead of HTTP
:ssl => false,
+
+ # Whether or not to display user's custom gravatars or only the generated ones
+ :forcedefault => 1,
}
# The methods that will be made available to your views.
@@ -73,7 +76,7 @@ module GravatarHelper
options[:default] = CGI::escape(options[:default]) unless options[:default].nil?
returning gravatar_api_url(email_hash, options.delete(:ssl)) do |url|
opts = []
- [:rating, :size, :default].each do |opt|
+ [:rating, :size, :default, :forcedefault].each do |opt|
unless options[opt].nil?
value = h(options[opt])
opts << [opt, value].join('=')
Updated by Sebastian M. about 14 years ago
Hello Felix, just got an email from the devs that dey added it to the API: http://en.gravatar.com/site/implement/images/
Best regards,
Sebastian
Updated by Sebastian M. about 14 years ago
Any chance to get this into the next version?
Updated by Felix Schäfer about 14 years ago
I have a working patch stashed in my local git repo, I wasn't able to make the spec run correctly though…
Eric Hulser: do you have the time to take care of running the spec for the gravatar plugin, I'd commit my changes to github in the evening (CEST) then.
Updated by Sebastian M. almost 14 years ago
Hmm does this mean nobody takes care of this ticket now? I successfully integrated Felix's patch, it works, so it should not be so difficult to integrate it into the admin options, shouldn't it? I am not a ruby coder, so unfortunately I can't do it myself. :/