<?php global $user; explode(",", $groupid); if (!group_memberships($groupid,$user->data['user_id'],true)) { die('<p>You are not allowed to view this page.</p> <p>If you cannot view this page even after logging in, you are not a member of the group that is allowed access to this page.</p> <p>Please contact the administrator for more details.</p>'); } ?>
[+error_msg+]
$modx->setPlaceholder('error_msg','Your Error Message here');
[!GroupAccess? groupid=`1` !] [+error_msg+] <p>The <a href="http://modxcms.com/modx-team.html" target="_blank">team behind MODx</a> strives to constantly add to and refine the documentation to help you get up to speed with MODx:</p> <ul> <li>For basic instructions on integrating custom templates into MODx, please see the <a href="http://modxcms.com/designer-guide.html" target="_blank">Designer's Guide</a>. </li> <li>For an introduction to working in MODx from the content editors perspectve, see the <a href="http://modxcms.com/editor-guide.html" target="_blank">Content Editor's Guide</a>. </li> <li>For a detailed overview of the backend "manager" and setting up Users and Groups, please peruse the <a href="http://modxcms.com/administration-guide.html" target="_blank">Administration Guide</a>.</li> <li>For developers, architecture and API documentation can be found in the <a href="http://modxcms.com/developers-guide.html" target="_blank">Developer's Guide</a>.</li> <li>And if someone has installed this site for you, but you're curious as to the steps they went through, please see the <a href="http://modxcms.com/getting-started.html" target="_blank">Getting Started Guide</a>.</li> </ul> <p>And don't forget, you can always learn and ask questions at the <a href="http://www.modxcms.com/forums" target="_blank">MODx forums</a>.</p>
The problem is in Evo, the placeholder always gets cached so this would have to be done on a non-cacheable page or you would need a non-cacheable snippet to return the error message instead of using a placeholder tag.
In Revo, you could just make the placeholder tag non-cacheable, but not an option in Evo.
Have it put into the placeholder if no error?
Quote from: OpenGeek at May 31, 2010, 03:32 PM
The problem is in Evo, the placeholder always gets cached so this would have to be done on a non-cacheable page or you would need a non-cacheable snippet to return the error message instead of using a placeholder tag.
In Revo, you could just make the placeholder tag non-cacheable, but not an option in Evo.
I can make the page non-cacheable. It’s not too big of a problem for me.
How do I prevent the content from loading when the error message shows up though?
regards
<?php global $user; explode(",", $groupid); if (!group_memberships($groupid,$user->data['user_id'],true)) { $modx->sendUnauthorizedPage(); } ?>