I made a snippet to insert a user-independent password secured chunkinside a page.
so if you have entered the password you can access the content provided by a chunk.
BUT...
my problem is every snippet call inside this chunk isnt parsed. while if the chunk is inserted in the page manuelly it is parsed.
is there any lock for the deepness of parsing or am i doing something wrong?
my code for the snippet is:
<?php
if(!isset($chunk) && !isset($password)) {
return '';
}
if(isset($loginChunk) && $modx->getChunk($loginChunk) != "") {
$loginTpl = $modx->getChunk($loginChunk);
} else {
$loginTpl = '<form action="[+pc.action+]" method="post"><input name="[+pc.inputname+]" type="password"/><input type="submit" value="Unlock"></form>';
}
$inputname = 'passwordChunk_login_'.md5($chunk); // only show one content if several are on one page
if($_POST[$inputname] == $password) {
return '{{'.$chunk.'}}'; // also tried return $modx->getChunk($chunk);
} else {
$id = $modx->documentObject['id'];
$loginTpl = str_replace("[+pc.action+]","[~".$id."~]",$loginTpl);
$loginTpl = str_replace("[+pc.inputname+]",$inputname,$loginTpl);
return $loginTpl;
}
?>