User:AndiRay/Article Comments

Modified ArticleCommet Extension 

Why what?
I'm using MediaWiki 1.13.2 PHP 5.2.6 (cgi-fcgi) MySQL 5.0.67-community-nt

I started to use the Extension:ArticleComments (from Jim R. Wilson User:Jimbojw) but whiched to have a "leave comment..." statement at the bottom of every site (except mainsites, like User:Subfader/Article Comments) and I wanted it to open a talkpage to each article (like the extension does by default). On the talkpage the "leave comment..." statement should stand at the top... beneath the comments should be displayed like [] but the newest ontop.

I came across alot of differculties by trying to achieve this... like:
 * double or tripple posting of the "leave comment..." statement
 * the statement was shown on the wrong sites
 * the statements werent shown on the right sites

Now I thought I should write about it... maybee it hepls some other noobs like me ^^

I will just write what I did... with my changes

= Installation =

Location and LocalSettings.php
First step the normal installation: 1. Download ArticleComments, and be sure to rename the downloaded file to ArticleComments.php. 2. Drop this script in $IP/extensions Note: $IP is your MediaWiki install directory. 3. Enable the extension by adding these lines to your LocalSettings.php: require_once('extensions/ArticleComments.php'); $wgArticleCommentDefaults['showurlfield']=false;//removes the URL field from the comment form $wgArticleCommentsNSDisplayList = array(NS_MAIN,NS_TALK,100,102,104,2); //the namespaceID's work (beware to use the right ones)

Specialpages
then I followed the instructions from: www.leerwiki.nl
 * Go to the special page MediaWiki:Article-comments-new-comment
 * Edit the page with

$3 said...      $4 $2

''Note: $3 said... is one of thos small changes that make a difference... this will make the name displayed in the comment, link to his userpage''
 * Go to the special page Mediawiki:Article-comments-commenter-said
 * Edit the page with

$3 said ...

Theme CSS
Also put the following CSS in your theme-CSS (...\mediawiki\skins\monobook)

div.comment { border: 1px solid silver; padding: 1px; margin-bottom: 16px; } div.commenttop { padding: 4px; background: #EEEEEE; } div.username { font: 11px verdana, arial, sans-serif; font-weight: bold; width: auto; float: left; } div.date { width: auto; text-align: right; } div.commentpost { padding: 4px; background: #F9F9F9; }

Monobook.php
then i followed the instructions on User:Subfader/Article Comments

Edit skins/monobook.php and find

Add the following code inbetween or if you have content in that section already, add it to the very end.



Note: Another change I hade to make

ArticleComment.php
Edit extension/ArticleComments.php (or maybee copypaste my file at the bottom), find... # Display the form if (in_array($title->getNamespace, $nsList)) { echo(wfArticleCommentForm($title, $params)); }

change to...

$mystring = $wgTitle; $findme1 = 'discussion'; $findme2 = 'talk'; $pos1 = strpos($mystring, $findme1); $pos2 = strpos($mystring, $findme2); if (in_array($title->getNamespace, $nsList)			&& $wgTitle != 'Main Page' 		&& $wgTitle != 'Other Page' 			) {		if ($pos1 === false && $pos2 === false) {				echo(wfArticleCommentForm($title, $params));#if its not a discussionpage it will perform }   	}
 * 1) Needet to search trough the link to find out if its a talkpage or whatever
 * 1) Display the form,
 * 2) && $wgTitle != 'sitename' on these sites the "leave comment ..." statement wont appear

find...

$wgMessageCache->addMessage('article-comments-talk-page-starter', " Comments on $1\n \n- \n"); $wgMessageCache->addMessage('article-comments-new-comment', "\n== \$1 ==\n\n \n\$2\n\n--\$3 \$4\n \n"); chage to...

$wgMessageCache->addMessage('article-comments-talk-page-starter', " \n Comments \n  "); $wgMessageCache->addMessage('article-comments-new-comment', "  $1 $4  $2  ");

find and comment it out or delete this part... if (!$skipCheck &&       preg_match('/]*)?\\/>/', $articleContent)===0 &&        preg_match('/]*)?\\/>/', $talkContent)===0    ) { $wgOut->setPageTitle(wfMsgForContent($ac.'submission-failed')); $wgOut->addWikiText(           " ".            wfMsgForContent($ac.'no-comments', $title->getPrefixedText).            " "        ); return; }
 * 1) Check whether the article or its talk page contains a flag

My ArticleComments.php file
hmm i guess that was it... if there are any questions please ask! I hope i didnt forget anything ^^ Hopefully this could help anyone!

AndiRay 08:08, 20 April 2009 (UTC)