Board Thread:Support Requests - Getting Technical/@comment-5693502-20150202013011/@comment-2170536-20150203012417

You are more than welcome, happy to help as much as I can. First off, let me say that I didn't mean to scare you (that much!) regarding the MediaWiki API. It is very powerful but can be a bit tricky; the hard part is making all of the calls properly and handling the output well. What you don't have to do is set it up for every user on the wiki individually. Since you are viewing these usertags on a user's profile, you already know which user to query the API for, so it's just a matter of returning the edit count for that particular user.

In terms of the importArticle call being done twice, if you look at lines 77-99 of your MediaWiki:Common.js file: /* UserTags from Dev Wikia */ window.UserTagsJS = { modules: {}, tags: {} }; UserTagsJS.modules.inactive = 30; UserTagsJS.modules.newuser = true; UserTagsJS.modules.newuser = { days: 5, // Must have been on the Wiki for 5 days edits: 30, // And have at least 10 edits to remove the tag namespace: 0 // Edits must be made to articles to count }; UserTagsJS.modules.autoconfirmed = true; UserTagsJS.modules.mwGroups = ['bureaucrat', 'chatmoderator', 'patroller', 'rollback', 'sysop', 'bot', 'bot-global']; importArticle({type:'script', article:'w:c:dev:UserTags/code.js'});

importArticles({   type: 'script',    articles: [        "MediaWiki:Common.js/Toggler.js",        'w:c:dev:UserTags/code.js'    ] });

At line 91 you have the following line: importArticle({type:'script', article:'w:c:dev:UserTags/code.js'});

And again at line 97, you have the same import statement (only this time part of a importArticles statement importing multiple documents): importArticles({   type: 'script',    articles: [        "MediaWiki:Common.js/Toggler.js",        'w:c:dev:UserTags/code.js'    ] });

Now you also see at the top of the file at line 18, you have multiple importScriptPage calls: importScriptPage('PurgeButton/code.js', 'dev');

importScriptPage('ExternalImageLoader/code.js', 'dev'); importScriptPage('ReferencePopups/code.js', 'dev'); importScriptPage('Countdown/code.js', 'dev'); importScriptPage('AutoEditDropdown/code.js', 'dev'); importScriptPage('OasisToolbarButtons/code.js', 'dev'); importScriptPage('BackToTopButton/code.js', 'dev'); importScriptPage('PortableCSSPad/code.js', 'dev'); importScriptPage('SexyUserPage/code.js', 'dev'); importScriptPage('SignatureCheck/code.js', 'dev'); importScriptPage('AllPagesHideRedirect/code.js', 'dev'); importScriptPage('Highlight/code.css', 'dev'); importScriptPage('Countdown/code.js', 'dev'); importScriptPage('ShowHide/code.js', 'dev');

Rather than doing these individually, you can combine them all into a single call: importArticles({   type: 'script',    articles: [       'u:dev:PurgeButton/code.js',       'u:dev:ExternalImageLoader/code.js',       'u:dev:ReferencePopups/code.js',       'u:dev:Countdown/code.js',       'u:dev:AutoEditDropdown/code.js',       'u:dev:OasisToolbarButtons/code.js',       'u:dev:BackToTopButton/code.js',       'u:dev:PortableCSSPad/code.js',       'u:dev:SexyUserPage/code.js',       'u:dev:SignatureCheck/code.js',       'u:dev:AllPagesHideRedirect/code.js',       'u:dev:Highlight/code.css',       'u:dev:Countdown/code.js',       'u:dev:ShowHide/code.js',    ] });

But there are also a half-dozen or so other import calls throughout that document that you could add to that. And you would put those all at the end of the file so that your variable declarations (like the UserTags) would be handled before the execution of the compound import statement, which ensures that the definitions will be present when they are needed.

Making some sense, I hope? :)