Merge pull request #273 from creative-commoners/pulls/3.1/name-that-member

FIX show name of members in summary tables
This commit is contained in:
Guy Marriott 2019-01-11 14:56:20 +13:00 committed by GitHub
commit 20c6a50f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,8 +125,8 @@ class Comment extends DataObject
* {@inheritDoc} * {@inheritDoc}
*/ */
private static $summary_fields = array( private static $summary_fields = array(
'Name' => 'Submitted By', 'getAuthorName' => 'Submitted By',
'Email' => 'Email', 'getAuthorEmail' => 'Email',
'Comment.LimitWordCount' => 'Comment', 'Comment.LimitWordCount' => 'Comment',
'Created' => 'Date Posted', 'Created' => 'Date Posted',
'Parent.Title' => 'Post', 'Parent.Title' => 'Post',
@ -450,6 +450,20 @@ class Comment extends DataObject
} }
} }
/**
* Return the comment authors email address
*
* @return string
*/
public function getAuthorEmail()
{
if ($this->Email) {
return $this->Email;
} elseif ($author = $this->Author()) {
return $author->Email;
}
}
/** /**
* Generate a secure admin-action link authorised for the specified member * Generate a secure admin-action link authorised for the specified member
* *