Skip to content
Permalink
Browse files

Fix broken avatar when default media source is modified

Merge remote-tracking branch 'origin/pr/14544' into 3.x

* origin/pr/14544:
  Fix empty image when gravatar disabled
  Replace two photo and gravatar fields with one - photo
  Fix broken previews in media browser and user avatar
  Fix user avatar on leftmenu
  Fix wrong avatar for recently edited resources and users online
  • Loading branch information...
opengeek committed Jul 25, 2019
2 parents 5597ecd + f70ab06 commit d374dbd071648c4ad2b359cd6c8172ae8bfeeb7f
@@ -4,6 +4,7 @@ development release, and is only shown to give an idea of what's currently in th

MODX Revolution 3.0.0-beta1 (TBD)
====================================
- Fix broken avatar when default media source is modified [#14544]
- Define IMG_WEBP constant in version of PHP without it [#14647]
- Setup redesign [#14507]
- Add widget welcome dashboard changes [#14607]
@@ -72,8 +72,11 @@ public function prepareRow(xPDOObject $object)
/** @var modUser $user */
if ($user = $object->getOne('User')) {
$row = array_merge($row, $user->get(['username']), $user->Profile->get(['fullname', 'email', 'photo']),
['gravatar' => $user->getGravatar(64)]);
$row = array_merge($row,
$user->get(['username']),
$user->Profile->get(['fullname', 'email']),
['photo' => $user->getPhoto(64, 64)]
);
/** @var modUserGroup $group */
$row['group'] = ($group = $user->getOne('PrimaryGroup')) ? $group->get('name') : '';
}
@@ -97,8 +97,11 @@ public function prepareRow(xPDOObject $object)
/** @var modUser $user */
if ($user = $object->getOne('User')) {
$row = array_merge($row, $user->get(['username']), $user->Profile->get(['fullname', 'email', 'photo']),
['gravatar' => $user->getGravatar(64)]);
$row = array_merge($row,
$user->get(['username']),
$user->Profile->get(['fullname', 'email']),
['photo' => $user->getPhoto(64, 64)]
);
/** @var modUserGroup $group */
$row['group'] = ($group = $user->getOne('PrimaryGroup')) ? $group->get('name') : '';
}
@@ -2288,4 +2288,4 @@ protected function isFileImage($file, $image_extensions = [])
return false;
}
}
}
@@ -1021,12 +1021,17 @@ public function getProfilePhoto($width = 128, $height = 128)
$this->xpdo->loadClass('sources.modMediaSource');
/** @var modMediaSource $source */
$source = modMediaSource::getDefaultSource($this->xpdo, $this->xpdo->getOption('photo_profile_source'));
$source->initialize();
$path = $source->prepareSrcForThumb($this->Profile->photo);
$thumb_param = array(
"zc" => 1,
"h" => $height,
"w" => $width,
"src" => $this->Profile->photo,
"source" => $source->id
);
return $this->xpdo->getOption('connectors_url', null, MODX_CONNECTORS_URL)
. "system/phpthumb.php?" . http_build_query(["zc" => 1, "h" => $height, "w" => $width, "src" => $path]);
. "system/phpthumb.php?" . http_build_query($thumb_param);
}
/**
@@ -16,7 +16,11 @@
<tr>
<td class="user-with-avatar">
<div class="user-avatar">
<img src="{(!empty($record.photo)) ? $record.photo : $record.gravatar}" width="32" height="32">
{if $record.photo}
<img src="{$record.photo}" width="32" height="32">
{else}
<i class="icon icon-user icon-2x"></i>
{/if}
</div>
<div class="user-data">
<div class="user-name">{$record.fullname}</div>
@@ -36,8 +36,11 @@
</td>
<td class="user-with-avatar">
<div class="user-avatar">
<img src="{(!empty($record.photo)) ? $record.photo : $record.gravatar}" width="32"
height="32">
{if $record.photo}
<img src="{$record.photo}" width="32" height="32">
{else}
<i class="icon icon-user icon-2x"></i>
{/if}
</div>
<div class="user-data">
<div class="user-name">{$record.fullname}</div>

0 comments on commit d374dbd

Please sign in to comment.
You can’t perform that action at this time.