John Sechrest - 2002-02-06

I use my PHPwiki as part of my classroom work
at Oregon State University. In the process, I believe it would be of value to allow for people
to post to the wiki, but to be the only ones who
can change a wiki word....

IE... If user "xyz" logs in, I would like only
xyz to be able to change the xyz journal.

So I made the following convention:

If a WikiWord is establish in the form of
[(xyz)-WikiWord]

Then only the administrator or the user 'xyz'
can edit the page.

To do this, I added the code:

diff editpage.orig.php editpage.php
38a39,40
>
>
56a59,81
>
>
> /// New Feature - jas
> /// if the string has a login- as the begining, then
> /// only the admin and the login can edit it.
> /// Perhaps it is easier coding to look for (specialchar)login-
> /// What would make a good special char?
>
> ///
>
>       $personalpagename="($PHP_AUTH_USER)";
>
>       if ( (substr($pagename,0,1) == '(')    && !(strncmp($pagename,$personalpagename,strlen($personalpagename)) == 0) && !defined('WIKI_ADMIN')) {
>        $html = "<p>";
>        $html .= gettext ("This page $pagename can only be edited by the owner.");
>        $html .= "\n<p>";
>        $html .= gettext ("Sorry for the inconvenience.");
>        $html .= "\n";
>        GeneratePage('MESSAGE', $html, sprintf (gettext ("Ownership Problem while editing %s"), $pagename), 0);
>        ExitWiki ("");
>       }
>
>