How do I add a link that would let user change their Gravatar on my site? (The same way you can change your Gravatar on Wordpress)
Thanks, Kenneth
How do I add a link that would let user change their Gravatar on my site? (The same way you can change your Gravatar on Wordpress)
Thanks, Kenneth
If you provide a link to http://en.gravatar.com/emails/ it will take them to the Gravatar site where they can log in and make changes to their account. I'm not sure if any other public API that would allow this change.
Looking at the html source on wordpress.com, it looks like they're using something like ThickBox to load the Gravatar site in an iframe:
<a href="https://secure.gravatar.com/accounts/force-by-email/wpcom/username/somecode?TB_iframe=true&height=475&width=960" id="gravatar_ui" class="thickbox" title="gravatar.com" onclick="return false;">
<img src="https://secure.gravatar.com/avatar/gravatarid?s=128&r=any&time=43179786" class="no-grav">
<p style="text-align: center;">Change your Gravatar</p>
</a>
Automattic's Gravatar API doesn't offer this functionality. Your best bet is to link the user to the Gravatar website.
If you really wanted you could do some experimenting with CSRF, I haven't tested to see whether the Gravatar site protects against this exploitation. Best case scenario, it would be spotty - I can't imagine anyone stays logged into the Gravatar account at all times like they would their Twitter account.
Finally, you could load the Gravatar site in an iFrame, so the user doesn't really leave your domain.
It should be possible to implement the chaning of a avatar using XML-RPC. The protocol is specified by Gravatar: http://en.gravatar.com/site/implement/xmlrpc/
There is actually a call
grav.saveData
- Save binary image data as a userimage for this account grav.saveUrl
- Read an image via its URL and save that as a userimage for this accountSo you need to implement the changing by yourself but you can avoid people to have to login at gravatar.
Gravatar does not allow this functionality. The only reason WordPress.com can do it is because they are both services from Automattic, and they both use WordPress.com accounts, so they got some extra strings pulled. Your best bet would be to link to the Gravatar website, or load it in an iframe. If you loaded it in an iframe, it would prompt them to log in to their WordPress.com account, unless they used WordPress.com frequently, and their browser stayed logged into that account.
© 2022 - 2024 — McMap. All rights reserved.