[pmwiki-users] Block Link Creation from Group
Patrick R. Michaud
pmichaud at pobox.com
Tue Feb 27 11:18:57 CST 2007
On Tue, Feb 27, 2007 at 04:57:57PM +0000, Hans wrote:
>
> Sivakatirswami's question was about blocking new page creations from
> an existing group.
To me, it's not really clear what the original question is asking.
His question doesn't say "an existing group", it says "any group":
How can one block creation of new pages in any group
where, for example, {$Group} = TODO* ??
And the subject says "link creation", not "page creation".
That's why my response was specifically tailored to answering
the question of limiting the creation of groups.
> So maybe the question needs refining:
> After initial creation of a number of pages in a group, how can we
> block creation of any further pages by authors editing the existing
> pages?
> Or as the topic subject suggest: How to block link creations in
> existing groups with a certain groupname pattern?
I don't like the phrase "block link creations" -- it sounds
as though one is trying to prevent authors from adding links
to a page. I think we're trying to prevent the creation of new
pages.
There's lots of ways to do this. An easy way is to create
an $EditFunction that disallows creating new pages:
function CreateDisallowed($pagename, $page, $new) {
global $EnableCreatePages, $EnablePost, $MessagesFmt;
if (IsEnabled($EnableCreatePages, 1)) return;
if (PageExists($pagename)) return;
$EnablePost = 0;
$MessagesFmt[] = 'Creation of new page blocked';
}
Then, to block creation of new pages, one simply sets
$EnableCreatePages = 0;
This can be done in a local/Group.php file to block new
pages for that particular group. To block creation of new
pages in groups matching a given pattern (say, all groups
beginning with 'TODO'):
if (preg_match('/^TODO/', $pagename))
$EnableCreatePages = 0;
Of course, the CreateDisallowed() function and/or $EnableCreatePages
setting can be made more sophisticated -- e.g., to allow admins
to create new pages even though others are blocked.
Pm
More information about the pmwiki-users
mailing list