Skip to content

Commit

Permalink
Merge pull request #750 from purplespider/fix-publish-profile-image-2
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkleiner authored Mar 20, 2024
2 parents 95a2808 + 9fae326 commit 0315457
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Model/BlogMemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class BlogMemberExtension extends DataExtension
'BlogProfileImage' => Image::class
];

private static array $owns = [
'BlogProfileImage',
];

/**
* @var array
*/
Expand All @@ -59,11 +63,6 @@ public function onBeforeWrite()
$this->owner->URLSegment = preg_replace('/-[0-9]+$/', '', $this->owner->URLSegment ?? '') . '-' . $count;
$count++;
}

// Auto publish profile images
if ($this->owner->BlogProfileImage() && $this->owner->BlogProfileImage()->exists()) {
$this->owner->BlogProfileImage()->publishSingle();
}
}

/**
Expand Down

0 comments on commit 0315457

Please sign in to comment.