Difference between revisions of "Bliki 1.0"
From Organic Design wiki
m |
m |
||
| Line 4: | Line 4: | ||
| − | + | Adding this code to the [http://www.mediawiki.org/Manual:Hooks/ArticleSave ArticleSave hook] makes sure that signatures are consistent and CSS addressable in any new sections that are added to talk pages. | |
{{code|<php> | {{code|<php> | ||
function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watch, $section, &$flags, &$status ) { | function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watch, $section, &$flags, &$status ) { | ||
| Line 16: | Line 16: | ||
</php>}} | </php>}} | ||
| − | Adding this code to the [http://www.mediawiki.org/Manual:Hooks/ArticleSave ArticleUpdateBeforeRedirect] | + | Adding this code to the [http://www.mediawiki.org/Manual:Hooks/ArticleSave ArticleUpdateBeforeRedirect hook] allows a ''returnto'' parameter to be added to the link for adding a comment (which is actually a new-section-edit link to a talk page) so that it returns back to the news page or the news item being commented on. |
{{code|<php> | {{code|<php> | ||
function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq ) { | function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq ) { | ||
| − | if( preg_match( "/returnto=(.+?)(&|$)/", $_SERVER['HTTP_REFERER'], $m ) ) | + | if( preg_match( "/returnto=(.+?)(&|$)/", $_SERVER['HTTP_REFERER'], $m ) ) $article->mTitle = Title::newFromText( $m[1] ); |
| − | |||
return true; | return true; | ||
} | } | ||
Revision as of 00:33, 5 January 2012
I've needed to set up blog-like functionality on a few wikis now, so I want to get the common features into one place so it's easier to implement in future.
Adding this code to the ArticleSave hook makes sure that signatures are consistent and CSS addressable in any new sections that are added to talk pages.
Adding this code to the ArticleUpdateBeforeRedirect hook allows a returnto parameter to be added to the link for adding a comment (which is actually a new-section-edit link to a talk page) so that it returns back to the news page or the news item being commented on.




