Merge pull request #303 from SilbinaryWolf/fix-changing-blog-pagetype

Fix bug where can't change 'Blog' page type to non-'Blog' page type
This commit is contained in:
Damian Mooyman 2015-11-20 12:49:54 +13:00
commit 7bddc86ab4

View File

@ -548,10 +548,13 @@ class Blog extends Page implements PermissionProvider {
$group = $this->getUserGroup(); $group = $this->getUserGroup();
foreach(array($this->Editors(), $this->Writers(), $this->Contributors()) as $levels) { // Must check if the method exists or else an error occurs when changing page type
foreach($levels as $user) { if ($this->hasMethod('Editors')) {
if(!$user->inGroup($group)) { foreach(array($this->Editors(), $this->Writers(), $this->Contributors()) as $levels) {
$user->Groups()->add($group); foreach($levels as $user) {
if(!$user->inGroup($group)) {
$user->Groups()->add($group);
}
} }
} }
} }