User:Yeidel/User Pages Editable Only By User
We want to have user pages act as truly "personal" pages, editable only by the owning user. While we understand that this is not "wiki-like", we are interested in providing a personal journal space for users that is integrated with the wiki and uses wiki markup, but that also provides them with a secure sense of ownership.
I wrote a patch to the userCan()
function of Title.php
that enables this-user-only editing of User: pages and subpages.
Superusers are NOT enabled to edit by this patch.
The thing to note is that userCan()
runs a number of tests, each one
returning false
if the user "can't". If none of the tests does a return
, then
userCan()
returns true
. So you can add as many disqualifying tests as
needed.
NOTE: This patch is for version 1.4.7; other versions not reviewed or tested
diff -u -r1.1.1.1 Title.php --- Title.php 21 Jun 2005 22:31:06 -0000 1.1.1.1 +++ Title.php 29 Aug 2005 20:56:59 -0000 @@ -803,6 +803,17 @@ wfProfileOut( $fname ); return false; } + + # CTLT - make user pages and subpages editable only by owning user + if ( NS_USER == $this->mNamespace && $action = 'edit' + && !preg_match('/^'.preg_quote($wgUser->getName(), '/').'\/?/', $this->mTextform) ) { + # user is not owner + wfProfileOut( $fname ); + return false; + } + # end CTLT mod foreach( $this->getRestrictions($action) as $right ) { if( '' != $right && !$wgUser->isAllowed( $right ) ) {