Authentication checks can be implemented in this menu snippet like this:
Add the authenticate field to the getActiveChildren()- approx line 157:
and rename the $childrenList to $childrenListOrig to enable the ability to loop through results prior to returning them...
Quote
for($geneCount=0;$geneCount < count($geneology);$geneCount++){[/code]
$childrenListOrig = $etomite->getActiveChildren($geneology[$geneCount], $sortString, null,'id, pagetitle, longtitle, parent, isfolder, description,authenticate');
Then add a loop to check each page for authentication... (select the method that returns the results that you require)...
This will return ONLY pages that are authenticated WHEN the user is logged in...
foreach($childrenListOrig as $childListItem){
if (($childListItem['authenticate'] == 1) &&
($etomite->checkPermissions($childListItem['id']) == true)
)
{
$childrenList[] = $childListItem;//build an array of docs to show
}
}
This will return ALL pages but BLOCK PAGES that are authenticated when the user is NOT logged in.
foreach($childrenListOrig as $childListItem){
if (($childListItem['authenticate'] != 1) ||
($childListItem['authenticate']== true ]
&& $etomite->checkPermissions($childListItem['id']) == true)
)
{
$childrenList[] = $childListItem;//build an array of docs to show
}
}
Now this hack assumes that
1) you have a method of authenticating through the front-end of the site like authenticate_visitor snippet.
2) that you have some sort of permissions management turned on in the site config, (whether they be document group permissions or simple visitor permissions)
3) that you have etomite versions 1.0 + (with the latest version of the checkPermissions API)
This is the source file with the second option (all pages with authenticated ones hidden (unless logged in) enabled:
listMenuAuth.txt 8.54K
4 downloads