Give me the full snippet using which if i visit the page it asks for password.After giving the password it show the page.
[b]I have put this in a chunk naMED PrivatePage[/b]
<?php
/* PrivatePage snippet */
/* Redirect users who shouldn't see this page */
/** @param $redirectTo string -- (optional) ID of page to redirect to;
* default: unauthorized page
* @param $userGroups string -- (optional) Comma-separated list of
* User Groups that are authorized;
* if not set, users who are not logged in are redirected
* */
$output = '';
function forward($id, &$modx) {
if (empty($id)) {
$modx->sendUnauthorizedPage();
}
$url = $modx->makeUrl((integer) $id, "", "", "full");
if (empty($url)) {
die('MakeUrl failed. ID: ' . $id);
}
$modx->sendRedirect($url);
}
$redirectTo = $modx->getOption('redirectTo', $scriptProperties, '');
$userGroups = $modx->getOption('userGroups', $scriptProperties, '');
if ((!empty($userGroups)) && strpos($userGroups, ',') !== false) {
$userGroups = explode(',', $userGroups);
}
if (empty($userGroups)) {
/* Redirect anyone who is not logged in */
$key = $modx->context->get('key');
if (!$modx->user->hasSessionContext($key)) {
forward($redirectTo, $modx);
}
} else {
/* redirect if not a member of specified group(s) */
if (!$modx->user->isMember($userGroups)) {
forward($redirectTo, $modx);
}
}
return $output;
?>
After saving this put the snippet on the page
[[!PrivatePage]]
Didnt work
Also used this
[[!PrivatePage? &userGroups=`Subscribers,Administrator` &redirectTo=`12`]]
But no helped
@coding31: Your posts are off topic for this thread, which is about the inability to save resources.
Please start a new thread.
@coding31 - Please and thank you and similar phrases may work better for you. Lmao