aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r--mod/groups/start.php13
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";
}