mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Don't show unmoderated comments unless user is admin, add link to accept comment
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39818 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bae1e1757d
commit
858e877858
@ -88,11 +88,9 @@ class SiteTree extends DataObject {
|
||||
* @return DataObjectSet Comments on this page.
|
||||
*/
|
||||
public function Comments() {
|
||||
if(isset($_GET['showspam'])) {
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->ID) . "'", "Created DESC");
|
||||
} else {
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->ID) . "' AND IsSpam = 0", "Created DESC");
|
||||
}
|
||||
$spamfilter = isset($_GET['showspam']) ? '' : 'AND IsSpam=0';
|
||||
$unmoderatedfilter = Permission::check('ADMIN') ? '' : 'AND NeedsModeration = 0';
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->ID) . "' $spamfilter $unmoderatedfilter", "Created DESC");
|
||||
|
||||
return $comments ? $comments : new DataObjectSet();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user