[pmwiki-users] Hiding groups like
Bart
pmwiki-users at mediamatrix.nl
Sun Oct 29 11:42:26 CST 2006
On Wed, Oct 25, 2006 at 01:13:59PM +0000, Pico wrote:
| Bart <pmwiki-users <at> mediamatrix.nl> writes:
|
| >
| > Hi,
| >
| > Once I read a trick from Pm how to hide the group "Pmwiki" from displaying
| > if you type the URL of a page from that group.
| >
| > E.g the URL your domain/PmWiki/DocumentationIndex would give a "page not
| > found"
| >
| > Iirc it was done by adding some code to config.php
| > Can anyone tell me how this can be done??
| >
| Your earlier post in another thread said you didn't want to use CMSMode (but
| didn't follow it closely enough to know why), but have you taken a look at
| the underlying code for ideas?
|
| Here is a relevant bit of code from Hagan's CMSMode.php that might be
| what you are looking for:
|
| ## Deny access to certain groups / pages.
| if (preg_match('!^(PmWiki|Test|Profiles)\\.!', $pagename)
| || (preg_match("!^$SiteGroup".'\\.!', $pagename)
| && !preg_match('!\\.(Search|ActionLog)$!', $pagename))
| || preg_match('!\\.(GroupHeader|GroupFooter|GroupAttributes|
| WikiSandbox|AuthUser)$!', $pagename))
| {
| global $DefaultPage; Redirect($DefaultPage);
| }
|
|
| Pico
|
|
| _______________________________________________
| pmwiki-users mailing list
| pmwiki-users at pmichaud.com
| http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Hi Pico,
Thanks, this is a bit a late reply cause I have been very busy in the last
week. Also thanks for the encouraging words. at first I was a bit thrown of
by all the PHP and regex code in the recipe. I am not a programmer, but a
person who like to understand want's to track what's going on and wants to
be able to and change things at his own desire
:-)
The code snippet you posted encouraged me to go on and I manged to get a
grasp
on the code. Finally I ended up with next working example
if ( ! $AuthId) {
## Exclude Certain pages / groups from search results when not loged in
global $SearchPatterns;
$SearchPatterns['default'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['default'][] = '!\\.(Group|Print)(Header|Footer)$!';
$SearchPatterns['default'][] = '!\\.(GroupAttributes|WikiSandbox)$!';
$SearchPatterns['default'][] = '!^(Test|Site|PmWiki|Profiles|Bart)\\.!';
## Deny access to certain groups / pages when not logged in
# These are granted
if (! preg_match('!^(Main|Profiles)\\.!', $pagename)
|| (preg_match("!^$SiteGroup".'\\.!', $pagename) &&
!preg_match('!\\.(Search|ActionLog)$!', $pagename))
||
preg_match('!\\.(GroupHeader|GroupFooter|GroupAttributes|WikiSandbox|AuthUser)$!',
$pagename))
{ global $DefaultPage; Redirect($DefaultPage); }
}
I also used the lose nofollow and time format code from the recipe
One questions remains, what's the use of:
$pagename = ResolvePageName($pagename);
without this line things still work properly so I am a bit in the dark about
this function.
Thanks again for your support, very useful :-)
Bart
More information about the pmwiki-users
mailing list