diff options
author | Steve Clay <steve@mrclay.org> | 2012-06-28 21:52:30 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-06-28 21:52:30 -0400 |
commit | b05caab768f9e1c4cbef4af87670dc87ef4d529f (patch) | |
tree | 27e6d89b09cbbb3cfbabc1ba04db1611bc9cce9c /mod/groups/start.php | |
parent | dbf78a975d2979ebeb50bd914b4ebc2c076ae09b (diff) | |
download | elgg-b05caab768f9e1c4cbef4af87670dc87ef4d529f.tar.gz elgg-b05caab768f9e1c4cbef4af87670dc87ef4d529f.tar.bz2 |
Fixes #4634: Restores pre 1.7 group profile pics after update
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r-- | mod/groups/start.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php index c8198371b..d6c2a47d2 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -284,12 +284,21 @@ function groups_url($entity) { * @return string Relative URL */ function groups_icon_url_override($hook, $type, $returnvalue, $params) { + /* @var ElggGroup $group */ $group = $params['entity']; $size = $params['size']; - if (isset($group->icontime)) { + $icontime = $group->icontime; + // handle missing metadata (pre 1.7 installations) + if (null === $icontime) { + $file = new ElggFile(); + $file->owner_guid = $group->owner_guid; + $file->setFilename("groups/" . $group->guid . "large.jpg"); + $icontime = $file->exists() ? time() : 0; + create_metadata($group->guid, 'icontime', $icontime, 'integer', $group->owner_guid, ACCESS_PUBLIC); + } + if ($icontime) { // return thumbnail - $icontime = $group->icontime; return "groupicon/$group->guid/$size/$icontime.jpg"; } |