Skip to content

Commit

Permalink
add option to fetch hidden article comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilles107 committed Sep 10, 2015
1 parent 0ed2d60 commit 8cbe547
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion newscoop/template_engine/classes/ArticleCommentsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &

$filter = array();
$filter = $this->m_constraints;
$filter['status'] = 'approved';
$filter['status'] = array('approved');
if ($p_parameters['show_hidden'] === true) {
$filter['status'][] = 'hidden';
}

$params = array(
'sFilter' => $filter
);
Expand Down Expand Up @@ -149,6 +153,7 @@ protected function ProcessParameters(array $p_parameters)
$parameters = array();
$parameters['ignore_language'] = false;
$parameters['ignore_article'] = false;
$parameters['show_hidden'] = false;
foreach ($p_parameters as $parameter=>$value) {
$parameter = strtolower($parameter);
switch ($parameter) {
Expand Down Expand Up @@ -181,6 +186,8 @@ protected function ProcessParameters(array $p_parameters)
break;
case 'nested':
if ($value == 'true') $this->_nested = true;
case 'show_hidden':
if ($value == 'true') $parameters[$parameter] = true;
default:
CampTemplate::singleton()->trigger_error("invalid parameter $parameter in list_article_comments", $p_smarty);
}
Expand Down
6 changes: 6 additions & 0 deletions newscoop/template_engine/metaclasses/MetaComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct($messageId = null)
$this->m_customProperties['parent'] = 'getParent';
$this->m_customProperties['has_parent'] = 'hasParent';
$this->m_customProperties['thread_level'] = 'threadLevel';
$this->m_customProperties['status'] = 'getStatus';

$this->m_skipFilter = array('content_real');
} // fn __construct
Expand Down Expand Up @@ -163,4 +164,9 @@ public function threadLevel()
{
return $this->m_dbObject->getThreadLevel();
}

protected function getStatus()
{
return $this->m_dbObject->getStatus();
}
}

0 comments on commit 8cbe547

Please sign in to comment.