Quote from: gerritvanaaken at Nov 09, 2010, 01:44 AM
Quote from: BobRay at Nov 08, 2010, 01:37 PM
No one has mentioned a solution to the issue of per-user pages: the tree_root_id User Setting. It’s quick and easy and each user can only see his or her own page (and potentially it’s children).
I wasn’t talking about backend access! We needed frontend access to a secure section of the website, where only one page would be available to one user...
Just put this at the top of your templates:
<?php
/* MemberPages Snippet */
/* First, reject any users who are not logged in */
if (!$isAuthenticated = $modx->user->hasSessionContext($modx->context->get('key')) ) {
$modx->sendUnauthorizedPage(); /* could also redirect to the Register page here */
}
/* if it's not the user's page, send them to the Members page */
$tr = $modx->getOption('tree_root_id');
if ($tr != $modx->resource->get('id') ) {
/* return "Wrong Page Tree Root:" . $tr . " Page ID: " . $modx->resource->get('id'); */
$modx->sendRedirect($modx->MakeUrl(##)); /* replace ## with the ID of the "Sorry" page */
}
?>
@Bob
Thank you for taking the time to write the code.
Quote from: cipa at Nov 09, 2010, 09:15 AM
@Bob
Thank you for taking the time to write the code.
My pleasure.
Note: I edited the potentially misleading comment in the last line.
Quote from: OpenGeek at Nov 08, 2010, 08:19 AM
Quote from: gerritvanaaken at Nov 07, 2010, 03:46 PM
It really is good to hear that most of my problems are well-known and being worked on! Keep up with that!
But still I have to drop a few lines on the alias path (sorry for being so annoying). MODx is not the only CMS with the ability of handling virtual folders...
Using relative paths to do the same thing is simpler and more efficient IMO. I’m sure it works different than other CMS’s, but it would complicate the system (and component development) enormously to have to calculate and manipulate server variables to some virtual folder path that doesn’t really exist on every request. And FWIW, you are welcome to prefix your links with or you can use to generate an "absolute" URL already prefixed with the base_path; similarly with the makeUrl() API method: <?php
$url = $modx->makeUrl(7, '', '', 'abs');
Hey Jason, where you have
shouldn’t it be
Owan Hunte
Web Developer
Barbados-based web development.
Before you bash it, learn it! There is nothing more annoying than an ill-informed rant.
We also appreciate Revolution very much.
Nevertheless Revo is not usable for us in commercial projects yet because there is no satisfactory way to produce single ssl-pages.
Our question: How much do we have to donate for getting a well working ssl-feature for single ssl-pages?
Letti