Difference between revisions of "Bliki 1.0"
From Organic Design wiki
(some code snippets) |
m |
||
| Line 8: | Line 8: | ||
function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watch, $section, &$flags, &$status ) { | function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watch, $section, &$flags, &$status ) { | ||
$title = $article->getTitle(); | $title = $article->getTitle(); | ||
| − | if( $title->getNamespace() == NS_TALK | + | if( $title->getNamespace() == NS_TALK && strpos( $_SERVER['HTTP_REFERER'], 'section=new' ) > 0 ) { |
$text = trim( str_replace( '~~~~', '', $text ) ); | $text = trim( str_replace( '~~~~', '', $text ) ); | ||
$text .= "\n<div class=\"comment-sig\">Posted by ~~~~</div>"; | $text .= "\n<div class=\"comment-sig\">Posted by ~~~~</div>"; | ||
Revision as of 00:30, 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.
This ArticleSave hook makes sure that signatures are consistent 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.




