Difference between revisions of "Bliki 1.0"

From Organic Design wiki
m
m
Line 19: Line 19:
 
{{code|<php>
 
{{code|<php>
 
function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq ) {
 
function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq ) {
if( array_key_exists( 'HTTP_REFERER', $_SERVER ) && preg_match( "/returnto=(.+?)(&|$)/", $_SERVER['HTTP_REFERER'], $m ) )
+
if( preg_match( "/returnto=(.+?)(&|$)/", $_SERVER['HTTP_REFERER'], $m ) )
 
$article->mTitle = Title::newFromText( $m[1], NS_MAIN );
 
$article->mTitle = Title::newFromText( $m[1], NS_MAIN );
 
return true;
 
return true;

Revision as of 00:31, 5 January 2012

Cone.png This article or section is a stub. Stubs are articles that have not yet received substantial attention from the authors. They are short or insufficient pieces of information and require additions to further increase the article's usefulness. The project values stubs as useful first steps toward complete articles.


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.


This ArticleSave hook makes sure that signatures are consistent in any new sections that are added to talk pages.

{{{1}}}

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.

{{{1}}}


See also