|
Cookbook /
LimitNewPagesInWikiGroupsSummary: How to limit the creation of new pages in your wiki group
Version: 2007-02-27
Prerequisites:
Status:
Maintainer:
Categories: Administration
Questions answered by this recipeCan I limit, block or constrain adding or creating new pages in wiki groups? Can I prevent users from creating new pages? DescriptionThe following code added to config.php will disallow creation of new pages in any group with a name beginning with "TODO". array_unshift($EditFunctions, 'CreateDisallowed');
function CreateDisallowed($pagename, $page, $new) {
global $EnableCreatePages, $EnablePost, $MessagesFmt;
if (IsEnabled($EnableCreatePages, 1)) return;
if (PageExists($pagename)) return;
Redirect('Main.PageCreationError'); #or some other page,
# or use next two code lines instead of the Redirect above
# $EnablePost = 0;
# $MessagesFmt[] = 'Creation of new page blocked';
}
if (preg_match('/^TODO/', $pagename))
$EnableCreatePages = 0;
To disallow new page creation for a specific group, you could either put all the code except the line into the group's local php file: local/GroupName.php, or replace if (preg_match('/^TODO/', $pagename))
$EnableCreatePages = 0;
with $group = PageVar($pagename, '$Group'); if($group=='GroupName') $EnableCreatePages = 0; How do I require a password to create a new page, but allow edits to existing pages to proceed without a password NotesRelease Notes
CommentsSee Also
Contributors |