mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Minor improvements to BlogMemberExtension
This commit is contained in:
parent
49bee390a3
commit
7b88435b7e
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user