Project:Support desk

Jump to navigation Jump to search

About this board

Welcome to's Support desk, where you can ask MediaWiki questions!

There are also other places where to ask :

Before you post

Post a new question

  1. To help us answer your questions, please always indicate which versions you are using (reported by your wiki's Special:Version page):
    • MediaWiki
    • PHP
    • Database
  2. Please include the URL of your wiki unless you absolutely can't. It's often a lot easier for us to identify the source of the problem if we can look for ourselves.
  3. To start a new thread, click "Start a new topic".
Previous page history was archived for backup purposes at Project:Support_desk/old on 2015-07-30.
Other languages: English  العربية čeština Esperanto français 日本語 中文

How can I add the asbox template to my Mediawiki?

This post was hidden by (history) (talkcontribs)
Bawolff (talkcontribs)

"37 templates before failing, and didn't solve the problem" <-- Well sounds like it didn't solve the problem because it "failed". Please detail how the import failed.

Also, enwikipedia isn't restricted from copying, it is only restricted from modification, you can copy the template from there if you want (but enwikiquote is just as good) (talkcontribs)

Thanks for replying. Turns out I needed to enable ParserFunctions in LocalSettings.php. The template works now.

I'd still like to get the aesthetics of the centered, outlined box with the graphic on the left and the different background color, but I've been unable to find any explanation of how that works, and it's not currently a top priority.

Bawolff (talkcontribs)

Its most likely that works via stuff in the page w:MediaWiki:Common.css (or equivalent from whatever wiki you are copying the template from). Sometimes templates use CSS in MediaWiki:Common.css (or rarely MediaWiki:Vector.css) to adjust colours and display stuff.

Some templates use the newer extension:TemplateStyles extension, but i don't think asbox is one of them.

Reply to "How can I add the asbox template to my Mediawiki?"

Easiest way to add Adsence for Mediawiki

12 (talkcontribs)

Hi, I have a mediawiki project (1.31) with Vector skin. What is the easiest way to add Adsence to my project? I'd like to have text ads in the left sidebar.

AhmadF.Cheema (talkcontribs) (talkcontribs)

Ahmad, thank you.

I read these links. But the extension is marked as not maintained. Is it still working? (talkcontribs)

The Google AdSense extension seems to be not working. I installed it, but it doesn't put in the head the script needed to activate account. When I open page's code I don't see anything related to adsence. But the extension itself is installed as I see in version.

Fokebox (talkcontribs)

I use Extension that inserts script b/n <head>. And adsense automatically inserted to all pages. (talkcontribs)

Fokebox, thank you. Which extension are you using? Did you face problems with adsense account approval? I've inserted their script in the head of every page and got rejected on the "no content" basis. I suppose that this is because of the script in wikimedia service pages, that relly do not have much content.

Fokebox (talkcontribs)

No I don't have such problems while I have a content at my wiki website.

I use this extension: Extension:HeadScript

Than I use automaticaly added adsense block script (auto ads):

So when you create any new wikipage google ads adsense block automaticaly (talkcontribs)

So you got accepted to adsense with you wiki website and script on all the pages? You didn't have adsense account approved through some other website?

Fokebox (talkcontribs)

I have registered account some years ago and it was approved by other website, that does not exist any more and now I use this account for my couple wiki projects, works fine (talkcontribs)
AhmadF.Cheema (talkcontribs)
TiltedCerebellum (talkcontribs)

I searched high and low for an option that worked for MW 1.33 but couldn't find one. Yes, there are other methods (better methods) but if Adsense doesn't see the initial approval code in the header they disregard it (apparently). No I don't have ads on my site yet, and yes I know there's a better way to place them (I plan to do that once approved) however, all the suggestions to put it elsewhere (those were endless) appeared moot if Adsense is looking in the header for their code first prior to approval. I just needed something quick and dirty for initial approval, then I could swap to a recommended/permanent solution when the code doesn't need to (and shouldn't be) in the head tags. Putting this in LocalSetting.php appears to work for first approval:

# Assign my functions to hook
$wgHooks['BeforePageDisplay'][] ='onBeforePageDisplay';

function onBeforePageDisplay( OutputPage &$out, Skin &$skin )
    $script = '<script data-ad-client="ca-pub-XXXXXXXXXXXXXXXX" async src=""></script>';
    $out->addHeadItem("wowhead script", $script);
    return true;

Reply to "Easiest way to add Adsence for Mediawiki"

How do I set the "remember me" checkbox to "checked" by default?

Tenbergen (talkcontribs)

I would like our users to remain logged, so would like the "remember me" checkbox set by default. I found an article that describes using a hook to do this ( It seemed hacky, but since I could not find a config setting to do this, I tried it. It actually works OK, except I now get an exception when I try to create a new user. Is there a proper way to set this box to "checked" by default? Thanks!

Ammarpad (talkcontribs)

This code should do want you want. I moved it there because this flow board cannot even format code properly.

Tenbergen (talkcontribs)

Thank you Ammarpad, that does the trick, and the account creation page works with this one. Will you maintain the answer at your sandbox or should I copy it into a subpage of my user page? Or is there a more appropriate place to document this?

Ammarpad (talkcontribs)

You can copy and reuse it anywhere. I don't know any appropriate documentation to add it now, if you happen to know one, you can add it (with appropriate caveat for hacks).

Reply to "How do I set the "remember me" checkbox to "checked" by default?" (talkcontribs)

I once used an API called wfMsgWikiHtml that is now erased. This is a serious problem since deprecated APIs need to be replaced. If it's not possible to know how they operated it's not possible to replace.

It now redirects to a page here with no mention of it. Perhaps it was never documented in the first place, but otherwise I don't think that I would have written code with it if I didn't see it used in other MediaWiki code that made clear its usage. (talkcontribs)

WfMsg statistics has an index of code for these, but it's not clear how to retrieve the source code marked at rev. 97412 according to the document. I found a github repository but GitHub doesn't seem to have a practical way to reference revisions.

Malyacko (talkcontribs)
Bawolff (talkcontribs) (talkcontribs)

(Obviously this isn't a good documentation system.)

Going by I need to implement wfMsgGetKey that isn't in that change/file, nor is it explained by the wfMessage wiki page.

I originally implemented a replacement with wfMessage($key)->parse() (though the wiki page suggests parseAsBlock) but I do have one instance that breaks down when the skin does $this->html('subtitle') that displays a subpage under the main heading. When the subpage title has an apostrophe, for example, the page is cut off there ending with & as if it's converted to &apos;

I'm upgrading so I'm not sure what to blame or if a better approximation of wfMsgWikiHtml would repair this behavior, or if it's just a breaking change. To replicate it I would need wfMsgGetKey code for the message to see. I think the problem is likely wfMessage adds &apos; (talkcontribs)

Hello again, I'm still curious about wfMsgGetKey however if anyone can look at (Topic:Vckr289fz0jyvhkw) this is the source the parsing bug I explained. (talkcontribs)

Sorry, I should explain the link refers to Extension:Arrays that has a variable ported to use extension.json that is not formatted correctly in its JSON form.

Bawolff (talkcontribs)

Indeed, looking at current docs of MediaWiki, for a feature that was replaced 7 years ago, isn't going to yield much info. Older versions of the docs are probably more relevant

wfMsgGetKey() is an implementation detail of the old system. It is roughly equivalent to either wfMessage( 'msgname' )->plain() or wfMessage( 'msgname' )->text() depending on the third argument. You

It would be unusual to use ->parseAsBlock(). 99% of the time you want ->parse() not ->parseAsBlock(). The most direct equivalent to wfMsgHtml() is wfMessage( 'keyname' )->rawParams( 'parameter' )->parse(). However, rawParams is strongly discouraged as it is very easy to give yourself an XSS security vulnerability, as it does no escaping of the parameter. It is strongly encouraged to use ->params() if at all possible.

Yes, ->parse() & ->parseAsBlock() will always convert apostrophes in the message to ' I don't understand how or why this is causing a problem. If it is because you are inserting the message inside a url, you should use urlencode to ensure its properly encoded for a url. If its not because of url, what's the context that the & causes a problem?

Just fyi, to lookup old svn revision numbers, you can go to Special:Code/MediaWiki/97412. It is also included in the git notes of the git repo, although those are often not downloaded by default during a git clone.

Reply to "Deprecated API is undocumented"

Migrate MindTouch Core 10.1.4 to MediaWiki

A1exP (talkcontribs)


Is there a guide available with instructions to migrate wiki MindTouch Core 10.1.4 to MediaWiki?


Alex (talkcontribs)

Did you ever get an answer?

A1exP (talkcontribs)


Reply to "Migrate MindTouch Core 10.1.4 to MediaWiki"

There seems to be a problem with your login session; This action has been canceled as a precaution against session hijacking. Please resubmit the form.

Guilherme bangemann (talkcontribs)

I'm getting this error when I try to Login in my account on my Wiki.

On my LocalSettings.php :

$wgMainCacheType = CACHE_ACCEL;

$wgMemCachedServers = [];

$wgSessionCacheType = CACHE_DB;

I want to bind with my LDAP. LDAP is set correclty. Works on anothers sites on my server.

I just need to use the Extension LDAP, and it doesn't works!


wfLoadExtensions( [
] );

$LDAPAuthorizationAutoAuthRemoteUserStringParser = 'solis';
$LDAPAuthentication2UsernameNormalizer = 'solis';
$LDAPAuthentication2AllowLocalLogin = true;
$wgAuthRemoteuserAllowUserSwitch = true;
$wgPluggableAuth_EnableLocalLogin = true;


$wgCookieSecure = false;

$wgShowExceptionDetails = true;



        "solis": {

                "connection": {

                        "server": "",

                        "user": "cn=read-only-admin,dc=solis,dc=coop,dc=br",

                        "pass": "password",

                        "options": {

                                "LDAP_OPT_DEREF": 1


                        "basedn": "dc=solis,dc=coop,dc=br",

                        "groupbasedn": "dc=solis,dc=coop,dc=br",

                        "userbasedn": "dc=solis,dc=coop,dc=br",

                        "searchattribute": "uid",

                        "searchstring": "uid=guilherme_bangemann,dc=solis,dc=coop,dc=br",

                        "usernameattribute": "uid",

                        "realnameattribute": "cn",

                        "emailattribute": "mail"


                "userinfo": {

                        "attributes-map": {

                                "email": "mail",

                                "realname": "cn",

"nickname": "uid",

                                "language": "preferredlanguage"



                "groupsync": {

                        "mapping": {

                                "mathematicians": "ou=mathematicians,dc=solis,dc=coop,dc=br",

                                "scientists": "ou=scientists,dc=solis,dc=coop,dc=br"





MarkAHershberger (talkcontribs)
Osnard (talkcontribs)

What is 'solis'? This does not look like a valid value for $LDAPAuthorizationAutoAuthRemoteUserStringParser and $LDAPAuthentication2UsernameNormalizer.

Can you please post the output of $wgDebugLogFile?

Guilherme bangemann (talkcontribs)

I fortgot:

And what's the directory for LogFile??

#$wgDebugLogFile = "/var/log/wiki/debug-{$wg}.log";

What I need to put on ".../debug-{???}.log"; ????

Guilherme bangemann (talkcontribs)
Guilherme bangemann (talkcontribs)

$wgDebugLogFile @Osnard

A1exP (talkcontribs)


Getting the same with LDAP stack on MW 1.31.

Was there a solution found for this?



Reply to "There seems to be a problem with your login session; This action has been canceled as a precaution against session hijacking. Please resubmit the form."
2610S (talkcontribs)

Is there any way to export all upload at once, or I need to copy/paste every pagename to Special:Export ?

AhmadF.Cheema (talkcontribs)
2610S (talkcontribs)

@AhmadF.Cheema My wiki only gives me the option of Add pages from category, I do not have the option of Add pages from category.

Why is this ?

AhmadF.Cheema (talkcontribs)
2610S (talkcontribs)

@AhmadF.Cheema exporting the upload pages only exports the pagename, but not the upload itself.

how can I export also the uploads ?

Reply to "Export all uploads"

I can't upload a file with MediaWiki

2 (talkcontribs)

I can't upload a file with MediaWiki. I get an error message:

PHP Fatal error:  Class 'XMLReader' not found in ....

I could upload files previously but I upgraded the operating system and reinstalled PHP. I don't remember how I check which version of MediaWiki I'm using.

I checked and libXML is enabled.

I'm using PHP Version

libXML support active
libXML Compiled Version 2.9.9
libXML Loaded Version 20904
libXML streams enabled (talkcontribs)


It works after running "sudo apt install php5.6-xml".

Reply to "I can't upload a file with MediaWiki"

Why do __HIDDENCAT__ pages appear in Special:Categories

Summary by Vicarage

It seems odd that Special:Categories does not split off things that are hidden, but the link to a curated page allows me to hide detail from users.

Vicarage (talkcontribs)

I've labelled various categories as __HIDDENCAT__, and indeed they don't appear at the page bottom unless a user preference is enabled, but they do appear in the Special:Categories, where they clutter the display for casual users.

Bawolff (talkcontribs)

that's just the way special:categories work - it shows alk categories, hidden or not

Vicarage (talkcontribs)

Is there a way to change the the 'Categories:' link at the page bottom in the categories box to point to a curated list. Wikipedia itself points to a help page, not its presumably enormous Special:Categories, for example

(My site design has strong control of categories, strict rules on their use, and lots of DPL reports to segment them, with some categories flagging up missing data in templates)

Bawolff (talkcontribs)

Where the link goes is controlled by the page MediaWiki:pagecategorieslink on your wiki

Vicarage (talkcontribs)

Just what I wanted, thanks

Meta tags in skin from MediaWiki template

Headshaker1 (talkcontribs)

Hi! I'm a little bit confused with interacting between template and skin.

Let's say i have a template in my MediaWiki like

 <div id="custom-person">
 * <span>Birthday:</span> {{#if: {{{birth date|}}} | <b>{{#ol-time:|{{{birth date}}}}}</b> | — }}
{{#if: {{{full name|}}} | * <span>full name:</span> <b>{{{full name}}}</b>}}
{{#if: {{{birth place|}}} | * <span>birth place:</span> <b>{{{birth place}}}</b>}}
{{#if: {{{age|}}} | * <span> age:</span> <b>{{{age}}}</b>}}
{{#if: {{{nationality|}}} | * <span> nationality:</span> <b>{{{nationality}}}</b>}}

<div class="clear"></div>





All these pages are in one Namespace (0).

I need to generate head meta tags with data from this template.

I figured out how to filter such a pages and add title tags in my SkinPerson.php

if ( $out->getTitle()->getNamespace() == 0 ) {
    $out->addMeta( "description", $out->getPageTitle());
    $out->addHeadItem( 'og:description', '<meta property="og:description" content="' . $out->getPageTitle() . '">');

But I'm really stuck on how can I insert in, say, 'og:description' tag something like {{{full name}}} + {{{age}}} ?

Thanks in advance!

TheDJ (talkcontribs)

wikitext templates are not simple key values, they are multilevel nested templating with logic that generates HTML. As such it is hard to retrieve the result of a parameter and reuse it elsewhere. Traditionally, we use parser functions like for instance #coordinates provided by Extension:GeoData. This parser function then is executing during the parsing of all the wikitext code of a page, extracts values and puts them into a storage location where it is reachable with database functions.

Then you reuse that information every time the page is rendered.

Maybe you should use something like Extension:Page Forms to store and retrieve your values. I suspect it will have some hooks that will allow you to retrieve the data in a hook so that you can add head items etc.

Ciencia Al Poder (talkcontribs)
Headshaker1 (talkcontribs)

Thank you! I'll try to solve it one of these ways

Jonathan3 (talkcontribs)

I use Extension:WikiSEO for this and suspect it would work for you too. I use it alongside Extension:Cargo but from memory it would work the same within any template.

Reply to "Meta tags in skin from MediaWiki template"