-
- 203 Posts
Hi,
I want to use external PHP files to build my module. I know I just have to use "require(’filename.php’);" but In that file... is there an easy way of keeping it from executing if it’s called from outside the manager?
something like :
if (!$Is_in_manager) {
die('you can,t do that!');
}
???
Also, how can I detect the user role and/or group? I want to show some sections depending on who is using it
bye and thanks in advance!!
Blaise
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!
Take a look at other Manager files, they all have a line at the beginning checking for just these things:
if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
if(!$modx->hasPermission('save_snippet') && $_REQUEST['a']==24) {
$e->setError(3);
$e->dumpError();
}
You can access the user values directly from the $_SESSION if you want.
-
- 203 Posts
Thanks! I think a short article should be written in the Doc about that... it could be usefull at least to have this copy/paste code
Blaise Bernier
www.medialdesign.com - Solutions for small business, hosting, design and more!