This question has been answered by BobRay. See the first response.
$docArray->where(array(
'published' => '0',
));$docArray = $modx->getChildIds(5,1,array('published' => '1'));$parentDoc = $modx->getObject('modResource', 5);
if ($parentDoc) {
$c = $modx->newQuery('modResource');
$c->where(array(
'published' => 1,
'searchable' => 1,
'deleted' => 0,
));
$children = $parentDoc->getMany('Children', $c);
foreach ($children as $child) {
$output .= $child->get('pagetitle');
}
} else {
$output = 'Parent not found';
}
return $output;The options array in my suggestion is probably only applying to the parent resource, not the children.
The "if" error sounds like a missing ; at the end of a previous line of code.