[pmwiki-users] Fwd: Re: how to exclude pages with a certain extension from

H. Fox haganfox at users.sourceforge.net
Thu Nov 16 17:56:31 CST 2006


On 11/16/06, Florian Fischer <Flori-Fischer at gmx.net> wrote:
> > Florian Fischer wrote:
> > > Hello,
> > >
> > > i have to exclude drafts from the searchresults, but i don't know the
> > syntax.
> > > i tried it with
> > > $SearchPatterns['default'][] = '!^MyGroup\\.*-draft$!';
> > >
> > > any ideas?
> > >
> > > Florian
> >
> > Try
> >
> >   $SearchPatterns['default'][] = '!-Draft$!';
> >
> > or, better yet
> >
> >   $DraftSuffix = '-Draft';
> >   $SearchPatterns['default'][] = "!$DraftSuffix\$!";
> >
> This works fine. But there's one problem. I would like to make these pages visible in searchresults if the user is an admin. Is there a way to manage this?

In a configuration file you can do things based on the authorization level.  Try

  $pagename = ResolvePageName($pagename);
  $isAdminAuthorized = CondAuth($pagename, 'admin');
  if (!$isAdminAuthorized) {
     $DraftSuffix = '-Draft';
     $SearchPatterns['default'][] = "!$DraftSuffix\$!";
  }

(after your authorization-related lines, of course).

Hagan




More information about the pmwiki-users mailing list