|
Cookbook /
PageCreatorSummary: adds page creator (original author) to be stored as a page attribute
Version: 2008-02-24
Prerequisites:
Status:
Maintainer:
Categories: Administration Security
Questions answered by this recipeHow can I set and safely store the name of the original page author or page creator? DescriptionAdding the code below will give you:
Add the following to config.php, or include within an add-on php script: # add cauthor to page attributes as extra field for ?action=attr
$PageAttributes['cauthor'] = '$[Page created by:]';
# add page variable {$CreatedBy}
$FmtPV['$CreatedBy'] = '@$page["cauthor"]';
# automatically set page creator to $Author for every new page
function SetPageCreator($pagename, &$page, &$new) {
global $EnablePost, $Author, $PageCreator, $Now;
SDV($PageCreator, $Author);
if ($EnablePost && !$new["author"])
$new["cauthor"] = $PageCreator;
}
array_unshift($EditFunctions, 'SetPageCreator');
NotesRelease Notes
See AlsoContributorsComments |