I am developing custom manager page with two files index.php and ajax.php. Index.php is a page which shows up in manager panel, from index.php page i call ajax.php via ajax call.
Problem is that, if i write below code in index.php i get logged in user id but when i use same code in ajax.php file it return 0 as logged user it. I even tried to pass id inside session, but again i dont see session variable in ajax.php.
If i dont check if user is logged in, then anyone can access ajax.php page.
How can i check is user is logged in and has manager access in ajax.php ?
require_once '../config.core.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
retun $modx->getLoginUserID();