Co-Authors-Plus
Co-Authors-Plus copied to clipboard
Javascript Implementation for the Author Box on a post loads Gravatar would like to support WP Avatar or BP Avatar
Hello,
I opened a support ticket - https://wordpress.org/support/topic/javascript-author-box-rendering-of-avatar-uses-gravatar?replies=1#post-7210800
But figured this might be a better place to discuss the issue.
When editing a post the author box is generated via javascript;
This javascript implementation simply uses the gravatar url comprised of the users MD5 email;
// Adapted from http://www.deluxeblogtips.com/2010/04/get-gravatar-using-only-javascript.html
function get_gravatar_link(email, size) {
var size = size || 80;
// need to check if page is secure or not
var gravatar_url = 'http://www.gravatar.com/avatar/';
if ("https:" == document.location.protocol) {
// secure
gravatar_url = 'https://secure.gravatar.com/avatar/';
}
return gravatar_url + MD5(email) + '.jpg?s=' + size;
}
When using Buddypress or WP Avatar the avatars are loaded into the actual system and gravatar is just a fall back. I'd like to support Buddypress Avatars and was wondering if there's anyway to access them through javascript so as to amend the co-authors-plus.js script to utilize the appropriate avatar image.
Thoughts/Advice appreciated. Thanks
This is due to a limitation of the autocomplete library we're using. Might finally be time to upgrade to a better autocomplete library that returns data via JSON or some other structured format rather than a list of text.