CTLpedia Documentation
From CTLpedia
Here is a list of modifications and plugins we have implemented in CTLpedia powered by MediaWiki.
Contents |
Only Page Creator Can Edit Page
To create this functionality you need to edit Title.php in wiki/includes/
Within the function userCan($action) and after
if( $action == 'create' ) {
if( ( $this->isTalkPage() && !$wgUser->isAllowed( 'createtalk' ) ) ||
( !$this->isTalkPage() && !$wgUser->isAllowed( 'createpage' ) ) ) {
wfProfileOut( $fname );
return false;
}
}
Add
if( $action == 'edit' ) {
if( $wgUser->isAllowed( 'protect' ) || $this->isTalkPage() ){
wfProfileOut( $fname );
return true;
}else if( !$this->isPageCreator() || $this->isMainPage() ){
wfProfileOut( $fname );
return false;
}
}
Then after
/**
* Get the revision ID of the next revision
*
* @param integer $revision Revision ID.
Get the revision that was after this one.
* @return interger $oldrevision|false
*/
function getNextRevisionID( $revision ) {
$dbr =& wfGetDB( DB_SLAVE );
return $dbr->selectField( 'revision', 'rev_id',
'rev_page=' . intval( $this->getArticleId() ) .
' AND rev_id>' . intval( $revision ) . ' ORDER BY rev_id' );
}
Add
function isPageCreator() {
$dbr =& wfGetDB( DB_SLAVE );
$creator = $dbr->selectField( 'revision', 'rev_user_text',
'rev_page=' . intval( $this->getArticleId() ) .
' ORDER BY rev_timestamp' );
echo $creator." ".$_SESSION['wsUserName'];
if ( $_SESSION['wsUserName'] == $creator || $creator == "" ){
return true;
}else{
return false;
}
}
Essentially, this makes the first user found in the history of an article the page creator. Then checks if the person currently logged in is the same as the page creator or a sysop to permit editing.
Image Thumbnailing
To learn how to implement image thumbnailing see Image Administration: Thumbnailing
Private Namespace
To learn to implement a custom private namespace see Preventing Access: Setting Permissions for a group
Custom Edit Toolbar
To implement a custom toolbar button see Create a cutom edit toolbar button
Display Math Equations
To learn to implement math equations see Enable TeX

