<![CDATA[ YAMS and redirecting agecheck doesn't work. - My Forums]]> https://forums.modx.com/thread/?thread=98700 <![CDATA[YAMS and redirecting agecheck doesn't work.]]> https://forums.modx.com/thread/98700/yams-and-redirecting-agecheck-doesn-t-work#dis-post-533728 The agecheck looks if there is a cookie, if yes then go to the homepage, if not go to the agecheck page.
When the agecheck is correct the NL homepage is loaded nomatter which language I came from.
I need it to redirect to the EN homepage after filling the EN agecheck..

Agecheck id: 1
Home id: 12
Logincheck is: 13

I use YAMS and default language is NL

All pages has this script:

<script>
if(!$.cookie("date") && [*id*] != 1) {
window.location="/[~1~]";
}
</script>


After the form is filled I go to ID 13. This works correct. When starting on the EN page I go to the EN logincheck page.
On that page there is a snippetcall:

[!loginchecker? &redirectTo=`12`!]


The snippet looks like:
<?php
if (isset($_COOKIE['date'])){
// here some code…
$url = $modx->makeUrl($redirectTo);
if ($refUrl != '') {
$url = $refUrl;
}
return $modx->sendRedirect($url);
}
$url = $modx->makeUrl(1);
return $modx->sendRedirect($url);
?>


I have looked for solutions but I don´t understand it that great.
Didn´t made the agecheck.

All I found are these posts but I don't know how to fix it.
http://stackoverflow.com/questions/21934144/equivalent-to-modx-getdocument-in-yams
https://rtfm.modx.com/extras/evo/yams/yams-english-documentation/yams-snippet

Is there someone who knows what to do?
]]>
fourroses666 Oct 27, 2015, 09:42 AM https://forums.modx.com/thread/98700/yams-and-redirecting-agecheck-doesn-t-work#dis-post-533728
<![CDATA[Re: YAMS and redirecting agecheck doesn't work.]]> https://forums.modx.com/thread/98700/yams-and-redirecting-agecheck-doesn-t-work#dis-post-533760 fourroses666 Oct 28, 2015, 03:38 AM https://forums.modx.com/thread/98700/yams-and-redirecting-agecheck-doesn-t-work#dis-post-533760