Image avatars should be seen as entity dependency as it is an entity attached to the user entity. This is a feature request but with a very high priority as this is a very much used attribute of the account entity.

I am currently checking why this is not working. The part to push this to a deploy plan already works by following hook.

/**
 * Implements hook_entity_dependenies().
 */
function user_entity_dependencies($entity, $entity_type) {
  if ($entity_type == 'user') {
    $dependencies = array();
    // The user has a 'file' dependency through the picture property.
    $dependencies[] = array('type' => 'file', 'id' => $entity->picture->fid);

    // You could try it the normal way, however the utility function would need to change as well.
    //$entity->picture = $entity->picture->fid;
    //entity_dependency_add($dependencies, $entity, 'file', array('picture'));

    return $dependencies;
  }
}

The patch will arrive later on, however I could use a couple of pointers to help me figure out how to add the knowledge of the file dependency to the deploy action itself.

CommentFileSizeAuthor
#3 1535520_3.patch779 bytesStalski
#1 1535520_2.patch715 bytesStalski

Comments

Stalski’s picture

Status: Active » Needs review
StatusFileSize
new715 bytes

Here is the patch

Status: Needs review » Needs work

The last submitted patch, 1535520_2.patch, failed testing.

Stalski’s picture

StatusFileSize
new779 bytes

Previous patch did not make sure avatars are actually used on the site and the picture is set.
This patch fixes that problem.

Stalski’s picture

Status: Needs work » Needs review
dixon_’s picture

Status: Needs review » Fixed

I like simple patches with high value :)

Committed, thanks!

Status: Fixed » Closed (fixed)

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