The Gravatar integration module integrates Drupal user pictures with the service provided by Gravatar in such a way that allows the user not to upload a picture, but use the default that's associated with her email, and lets Drupal use that picture as her user picture.

Steps to reproduce: Install gravatar.module & ds.module, set up a user with a Gravatar-provided picture (it does get displayed on the user's profile page), set up a DS layout to use the user's picture: it doesn't get displayed.
Error: When Display Suite renders a user's picture, and that user does not have an "own", uploaded picture, but only a Gravatar-provided one, it does not get displayed. (If the user has her "own", uploaded picture, it does get displayed, though.)
Expected behavior: DS should display the Gravatar-provided user picture( replacement)s as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Boobaa’s picture

I could work around this issue by using the following patch:

--- ds.module.orig      2011-05-24 10:21:35.676592552 +0200
+++ ds.module   2011-05-24 10:29:40.656592737 +0200
 -741,6 +741,10 @@ function ds_return_picture($entity) {
  * Render a user picture.
  */
 function ds_render_user_picture($field) {
+  if (module_exists('gravatar')) {
+    $account = user_load($field['entity']->uid);
+    return theme('user_picture', array('account' => $account));
+  }
   $picture = ds_return_picture($field['entity']);
 
   if (!empty($picture)) {

As I'm quite new to DS, I don't know if it's a proper way to handle the issue; most likely it isn't. Anyway, this does Work For Me (TM).

swentel’s picture

As you said, it's probably not the nicest solution, but I'll do a test myself. I'd rather want to move the check to the ds_return_picture() function and probably use _gravatar_get_account_user_picture() function from the gravatar module itself.

swentel’s picture

Status: Active » Fixed

Committed to dev

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jonardern’s picture

Version: 7.x-1.1 » 6.x-1.4
xtfer’s picture

Version: 6.x-1.4 » 7.x-1.1

Correcting version.

swentel’s picture

Version: 7.x-1.1 » 6.x-2.x-dev

Hmm, I think this actually still applies to the 6 version - it's fixed in the 7 branch already.

xtfer’s picture

Status: Closed (fixed) » Active

Ah, so its a backport... reopening then.

MaTaX’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

so is this fixed or not, I'm using the latest version of this module ad I can't get gravatar images to work

swentel’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

That works yes

MaTaX’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

hmm that's weird, it's still not working for me

what version of this module is it confirmed working in? I have tried the stable and the first dev 2-x release

swentel’s picture

Issue tags: +beta blocker

tagging

swentel’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
FileSize
409 bytes

Ok, here's the patch to make it work on everything else like nodes, comments etc, committed to both branches. Back to 6.x

swentel’s picture

Issue tags: -beta blocker

Removing tag

thedavidmeister’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Active » Needs review
FileSize
434 bytes

It isn't just $entity->mail that you need to make sure you hand off to Gravatar. The entity can be missing a role as well #1440846: Notice: Undefined property: stdClass::$roles in user_access() which leads to php errors and pictures not displaying.

Gravatar unconditionally runs _gravatar_load_account() over "account like" objects that it is about to send to _gravatar_get_account_user_picture(), see gravatar_preprocess_user_picture() for an example.

If DS doesn't mimic what Gravatar is doing with internal functions, there's always a chance that bugs will creep in over time.

Patch attached for 7.x-2.x

swentel’s picture

Status: Needs review » Fixed

Alright, thanks. Committd to 7.x-2.x, 7.x-1.x and 8.x-2.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.