[Mediawiki-l] Using the hook AlternateEdit to auto-add an edit summary
Brianna Laugher
brianna.laugher at gmail.com
Mon May 7 16:23:05 UTC 2007
Hi,
I'm trying to write an extension, that is intended to provide a
special page with a list of translations. I want to offer a link that
says 'update translation' and when they click on it, it leads to an
edit box for that page with an already-filled in edit summary,
"updating translation to rev $1".
So the links on my special page are like
'index.php?title=Test&action=edit&translationrev=1706'
this is what I wrote:
<code>
$wgHooks[ 'AlternateEdit' ][] = 'TranslationUpdateEdit';
/**
* Function: TranslationUpdateEdit
* - Inserts custom summary for users updating translation pages
*
* @param $editpage: the editpage (object) being called
*/
function TranslationUpdateEdit( &$editpage ) {
global $wgRequest, $wgOut;
$rev = $wgRequest->getVal( 'translationrev' );
if ( $rev ) {
$editpage->summary = wfMsgForContent(
'translatorhelp_updateeditsummary', $rev );
$wgOut->addHTML("there was a rev!");
} else {
$wgOut->addHTML("there was no rev!");
}
return true;
}
</code>
When I follow the link from my Special page, the edit page says "there
was a rev!" so I am confident my function here is being utilised, but
the edit summary is still blank.
What am I doing wrong?
thanks in advance,
Brianna
More information about the MediaWiki-l
mailing list