[pmwiki-users] easy question to all
Patrick R. Michaud
pmichaud at pobox.com
Wed Oct 15 13:43:09 CDT 2008
On Wed, Oct 15, 2008 at 12:11:25PM -0500, Tegan Dowling wrote:
> On Wed, Oct 15, 2008 at 9:00 AM, Vince Administration wrote
> > On Oct 15, 2008, at 9:41 AM, Patrick R. Michaud wrote:
> >> Note that the code I gave depends on the existence of a page called
> >> "HomePage" in whatever group the page being edited belongs to. So,
> >> if you try to edit Group.ABC and Group.HomePage doesn't exist, then
> >> it'll look for the group password.
> >>
> >> Perhaps a better approach would be:
> >>
> >> $pagename = ResolvePageName($pagename);
> >> $rc = FmtPageName('$Group.HomePage', $pagename);
> >> if (!PageExists($pagename) && !PageExists($rc))
> >> $DefaultPasswords['edit'] = crypt('group_creation_password');
> >>
> >
> > We don't use $Group.HomePage (except in Main). For some groups we
> > have $Group.$Group, and for others $Group.Index.
>
> Looking back at the original post in the thread, the instructions
> refer to testing for a group's RecentChanges page, since that is the
> one certain test for the existence of a group. What would the code
> look like for that?
When writing the above I was simply following the example of the
original post. To check for RecentChanges instead of HomePage
one would use:
$pagename = ResolvePageName($pagename);
$rc = FmtPageName('$Group.HomePage', $pagename);
if (!PageExists($pagename) && !PageExists($rc))
$DefaultPasswords['edit'] = crypt('group_creation_password');
This is described at http://www.pmwiki.org/wiki/Cookbook/LimitWikiGroups .
Pm
More information about the pmwiki-users
mailing list