diff options
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 8eb0d4036..d85bb6492 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -283,12 +283,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"; } |