mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Only show unmoderated comments if the user is an admin
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39834 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d5a0cf374f
commit
ca4a3b91d8
@ -65,11 +65,9 @@ class PageCommentInterface extends ViewableData {
|
||||
$limit = "0,".PageComment::$comments_per_page;
|
||||
}
|
||||
|
||||
if(isset($_GET['showspam'])) {
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->page->ID) . "'", "Created DESC", "", $limit);
|
||||
} else {
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->page->ID) . "' AND IsSpam = 0", "Created DESC", "", $limit);
|
||||
}
|
||||
$spamfilter = isset($_GET['showspam']) ? '' : 'AND IsSpam=0';
|
||||
$unmoderatedfilter = Permission::check('ADMIN') ? '' : 'AND NeedsModeration = 0';
|
||||
$comments = DataObject::get("PageComment", "ParentID = '" . Convert::raw2sql($this->page->ID) . "' $spamfilter $unmoderatedfilter", "Created DESC", "", $limit);
|
||||
|
||||
if(is_null($comments)) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user