Vote #68212
未完了Gravatars: Add option to force default avatar display
0%
説明
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.
journals
I'll try to have a look at this tonight, the patch probably won't make it to version:1.0.2 though.
--------------------------------------------------------------------------------
I couldn't find any mention of that in the API docs, and we won't support unofficial APIs where we can avoid it.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
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 :-)
--------------------------------------------------------------------------------
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?
--------------------------------------------------------------------------------
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:
<pre><code class="diff">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('=')</code></pre>
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
Any chance to get this into the next version?
--------------------------------------------------------------------------------
I have a working patch stashed in my local git repo, I wasn't able to make the spec run correctly though…
@Eric: 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.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
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. :/
--------------------------------------------------------------------------------