diff --git a/code/extensions/BlogMemberExtension.php b/code/extensions/BlogMemberExtension.php index 3ade07e..815bbb3 100644 --- a/code/extensions/BlogMemberExtension.php +++ b/code/extensions/BlogMemberExtension.php @@ -10,7 +10,7 @@ class BlogMemberExtension extends DataExtension { private static $db = array( - 'URLSegment' => 'Varchar', + 'URLSegment' => 'Varchar(50)', 'BlogProfileSummary' => 'Text' ); @@ -47,8 +47,7 @@ class BlogMemberExtension extends DataExtension { */ public function generateURLSegment() { $filter = URLSegmentFilter::create(); - $name = $this->owner->FirstName . ' ' . $this->owner->Surname; - $urlSegment = $filter->filter($name); + $urlSegment = $filter->filter($this->owner->getName()); // Fallback to generic profile name if path is empty (= no valid, convertable characters) if(!$urlSegment || $urlSegment == '-' || $urlSegment == '-1') $urlSegment = "profile-$this->ID"; @@ -70,7 +69,7 @@ class BlogMemberExtension extends DataExtension { $conflict = $conflict->exclude('ID', $this->owner->ID); } - return $conflict->count() == 0; + return !$conflict->exists(); } }