[pmwiki-users] Creating default group pages?

Roman romat2 at gmail.com
Wed Apr 25 04:16:08 CDT 2007


On 4/24/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Tue, Apr 24, 2007 at 03:01:09PM +0200, Roman wrote:
> > Hans,
> > would it be difficult to modify AutoGroupPages recipe to create also
> > group directory in "uploads"?
>
> Perhaps the following will work:
>
>
> function AutoCreateUploadDirectory($pagename, $page, $new) {
>   global $IsPagePosted, $UploadFileFmt;
>
>   if (!$IsPagePosted) return;
>   $uploaddir = FmtPageName($UploadFileFmt, $pagename);
>   mkdirp($uploaddir);
> }
>
> $EditFunctions = 'AutoCreateUploadDirectory';

Thank you, these few lines help a lot.

Working code needed little modification:

function AutoCreateUploadDirectory($pagename, &$page, &$new) {
 global $IsPagePosted, $UploadFileFmt;

 if (!$IsPagePosted) return;
 $uploaddir = FmtPageName($UploadFileFmt, $pagename);
 mkdirp($uploaddir);
}

$EditFunctions[] = 'AutoCreateUploadDirectory';

Roman



More information about the pmwiki-users mailing list