Page MenuHomePhabricator

VoteNY shows section for commenting and at end of the article and under the title
Closed, InvalidPublic

Description

As I need to have an option for voting everywhere, and adding tags on a very big number of pages doesn't make sense, I added this code and placed it in the LocalSettings.php:

$wgHooks['ArticleViewHeader'][] = 'addHeaderToPages';

function addHeaderToPages( &$article, &$outputDone, &$pcache ) {
	global $wgOut;
	$wgOut->addWikiTextAsInterface('<vote type=1 />');
	return true;
}

But, for some reason, I have a section for commenting and at end of the article and under the title. It is duplicated (I don't know why), the easiest way to say.

I know that Phabricator isn't a place for support, but I'm not sure where to ask, as I haven't received responses on IRC.

The version of the MediaWiki where I have to work on this is 1.36.0.

Event Timeline

This looks like a very neat little code snippet that would make a fine addition to VoteNY as a configurable option. 👍 (And I bet a lot of MediaWiki-extensions-Comments users would be delighted to see the same implemented for that extension as well!) As some tiny little nitpicks:

  1. You can use $article->getContext()->getOutput() instead of the $wgOut global, given that global objects are deprecated and being phased out
  2. return true; is superfluous and not needed (from MediaWiki 1.10 to 1.22 hooked functions had to return a boolean value; this requirement has since been lifted, but a lot of codebases haven't been updated to reflect this change because having those bool retvals there doesn't harm anyone or anything in 99% of the cases)

But, for some reason, I have a section for commenting and at end of the article and under the title. It is duplicated (I don't know why), the easiest way to say.

Your code worked just fine for me when I tested it on my 1.35 box, despite that I have a boatload of custom extensions and skins installed. Can you please share more details about your 1.36 box, such as a screenshot of the issue, a screenshot of Special:Version and maybe a URL to the problematic site if it's public?

I know that Phabricator isn't a place for support, but I'm not sure where to ask, as I haven't received responses on IRC.

Usually I'm inclined to agree, yes, but this isn't really a "how do I configure <something>?" question, but rather this is a feature request for something that has been requested (for both Comments and VoteNY) many times over the past 13+ years, and so far I've had to tell everyone who asked, "sorry, it's not really possible". So I for one would be delighted to see the code incorporated into both extensions! 😍

This looks like a very neat little code snippet that would make a fine addition to VoteNY as a configurable option. 👍 (And I bet a lot of MediaWiki-extensions-Comments users would be delighted to see the same implemented for that extension as well!) As some tiny little nitpicks:

  1. You can use $article->getContext()->getOutput() instead of the $wgOut global, given that global objects are deprecated and being phased out
  2. return true; is superfluous and not needed (from MediaWiki 1.10 to 1.22 hooked functions had to return a boolean value; this requirement has since been lifted, but a lot of codebases haven't been updated to reflect this change because having those bool retvals there doesn't harm anyone or anything in 99% of the cases)

But, for some reason, I have a section for commenting and at end of the article and under the title. It is duplicated (I don't know why), the easiest way to say.

Your code worked just fine for me when I tested it on my 1.35 box, despite that I have a boatload of custom extensions and skins installed. Can you please share more details about your 1.36 box, such as a screenshot of the issue, a screenshot of Special:Version and maybe a URL to the problematic site if it's public?

I know that Phabricator isn't a place for support, but I'm not sure where to ask, as I haven't received responses on IRC.

Usually I'm inclined to agree, yes, but this isn't really a "how do I configure <something>?" question, but rather this is a feature request for something that has been requested (for both Comments and VoteNY) many times over the past 13+ years, and so far I've had to tell everyone who asked, "sorry, it's not really possible". So I for one would be delighted to see the code incorporated into both extensions! 😍

@ashley Thanks for these hints! Wiki is https://it.everything.wiki

I think there was a conflict with extensions. I've disabled the CommentBox extension. Everything is okay with the wiki now.

I'm closing this task now.