@zven69
Try this snippet code instead of the original.
It now evaluates if the user is logged in and displays private web pages in the menu.
If they are not logged in they don’t show in the menu.
Tested quickly by me.
<?php
$siteName = $modx->config['site_name'];
$output = '';
$output .= '<script type="text/javascript">
<!--
d = new dTree(\'d\');
d.add(0,-1,\'Sandbox Menu\');';
if ($modx->getLoginUserID())
{
$result = mysql_query('SELECT * FROM `modx_site_content` WHERE `published`= 1 AND `hidemenu`= 0 AND `deleted`= 0 ORDER BY `menuindex` ASC ');
while($row = mysql_fetch_array($result))
{
$output .= 'd.add( '. $row['id'] . ' , '. $row['parent'] . ' , \''. $row['pagetitle'] . '\', \'[~'. $row['id'] . '~]\');'."\n";
}
}
else
$result = mysql_query('SELECT * FROM `modx_site_content` WHERE `published`= 1 AND `hidemenu`= 0 AND `deleted`= 0 AND `privateweb`= 0 ORDER BY `menuindex` ASC ');
while($row = mysql_fetch_array($result))
{
$output .= 'd.add( '. $row['id'] . ' , '. $row['parent'] . ' , \''. $row['pagetitle'] . '\', \'[~'. $row['id'] . '~]\');'."\n";
}
$output .= '
document.write(d);
//-->
</script>';
return $output;
?>