FANDOM


  • It has been 2 and a half years, but it is still not yet resolved. w:c:community:Forum:Adding_Personal_EditCount_as_a_JS_Variable

    I need to fetch the edit count of a user in A CERTAIN wiki (e.g. this wiki), and then put it into the corresponding places: e.g. I made 6000 edits in a certain wiki, I will be in level 20, which will be reached when you reached the 5900th edit.Just some if and else statements which I can go with it

    Then, put a "LEVEL XX" user tag on the user page (the ones next to the user name, e.g. "ADMIN", "BLOCKED").

    This suggestion has been deserted by ShermanTheMythran, who originally suggested this feature. Monchoman45 and Mathmagician went for it but as the time passed, there were no new responses.

    So, anybody interested in this? Leave a message!

      Loading editor
    • 452

      In other words:

      • When looking at a user profile page,
      • get the displayed editcount,
      • compare it to a predefined list of levels,
      • and display the corresponding level as a tag.

      Is this correct?

        Loading editor
    • 452 wrote: In other words:

      • When looking at a user profile page,
      • get the displayed editcount,
      • compare it to a predefined list of levels,
      • and display the corresponding level as a tag.

      Is this correct?

      Exactly.

        Loading editor
    • 452
      //When looking at a user profile page,
      if ($("#UserProfileMasthead").size()) {
      
      //get the displayed editcount,
        editCount = $("#UserProfileMasthead .tally em").html().replace(",","");
      
      //compare it to a predefined list of levels,
        editRanks = {
           1:"Newbie",
           10:"Starter",
           50:"Beginner",
           100:"Whatever",
           100000:"Through the roof",
        }
        for(i in editRanks) if (editCount >= parseInt(i)) editRank = editRanks[i];
      
      //and display the corresponding level as a tag.
        if (editCount) 
          $("#UserProfileMasthead hgroup").append(
            $("<span>").addClass("tag").html(editRank)
          );
      
      }
      

      I've written this as a general case so that anyone can use it, so if you want to use numbers, just change the rank strings to numbers.

      As it is, "Beginner" would be displayed for people with 50 to 99 edits. Obviously you can tweak the levels to whatever you want.

      Personally, I wouldn't use something like this, as it would encourage people making frivolous edits, similarly to the achievement system. But maybe this won't happen on your wiki, good luck!

      edit: Updated significantly, feel free to ask if you have any questions.

        Loading editor
    • I saw your code. Thanks! (I'm not able to leave school until 5pm, and now it's 6:15)

        Loading editor
    • The problem is, when UserTags is loaded alongside this feature, the level system tag disappears right before UserTags is loaded.

        Loading editor
    • Should you ask Lunarity to include this feature to his UserTags project?

        Loading editor
    • 452

      No, I have no reason to do that.

      If you want to use them both, then you should tell Lunarity that his script does not play nicely with other scripts.

        Loading editor
    • Or, instead of showing the level as a tag, could you make this so there will be no conflicts with the UserTags function? (the number 4 shown in the picture is the number of level)

      Levelsystem

        Loading editor
    • 452 Ive tried out your script and I cant seem to get it to work any suggestions?

        Loading editor
    • 452

      Try temporarily disabling the "userRightsIcons" script here: http://brotherhoodofthefallen.wikia.com/wiki/MediaWiki:Wikia.js

      edit: Oh, you're also using "userTags" here: http://brotherhoodofthefallen.wikia.com/wiki/MediaWiki:Common.js

      Both of those scripts remove all tags.

      edit: Changing the "span" in my script to "div" will fool the userRightsIcons script into not remove the tags, but unfortunately the "userTags" script just removes anything labelled ".tag". So you will have to take it up with the author of that script.


      Additionally, you have CSS in your common.js file, which is causing this error:

      Uncaught Error: JavaScript parse error: Parse error: Missing operand in file 'MediaWiki:Common.js' on line 644
      

      Remove these:

      .WikiaTopAds, .home-top-right-ads, .wikia-ad, .SelfServeUrl,
      .WikiaActivityModule, .WikiaFooter, #WikiaArticleBottomAd,
      .LatestPhotosModule, .ChatModule, .WikiaAdInContentPlaceHolder,
      .WikiaAdInContent { display:none !important; }
      
        Loading editor
    • Thank you so much dude also so i have to remove the usertags in order to run your script?

        Loading editor
    • 452

      Currently, yes.

      Either that or ensure that my script runs after the UserTags script.

        Loading editor
    • and how can i do that

        Loading editor
    • 452

      Try this, it might work, but I'm not 100% sure, because I don't use those other scripts.

      document.onreadystatechange = function () {
        if (document.readyState == "complete") {
          if ($("#UserProfileMasthead").size()) {
            editRanks = {
              1:"Newbie",
              10:"Starter",
              50:"Beginner",
              100:"Whatever",
              100000:"Through the roof",
            }
            editCount = $("#UserProfileMasthead .tally em").html().replace(",","");
            if (editCount) {
              for(i in editRanks) if (editCount >= parseInt(i)) editRank = editRanks[i];
              $("#UserProfileMasthead hgroup").append($("<span>").addClass("tag").html(editRank));
            }
          }
        }
      }
      

      edit: Thanks for confirming it, Yhynerson1!

      edit: It's disappointing that I can find several people who have used this script, but I can't find anyone who has given the appropriate credit.

        Loading editor
    • it works. thanks

        Loading editor
    • Im extremely pissed off about this! Your script fucked up my wiki I cant edit pages with the new editor. It will just load forever! Please fix this!


      http://evolve.wikia.com/wiki/MediaWiki:Common.js

        Loading editor
    • 452

      MythicConditor wrote:

      Your script fucked up my wiki
      False.

      I do not understand how you managed to copy/paste it so poorly, but my script, as displayed here, is not what you have added to your wiki, and is therefore not the problem.

      I will not help you fix it until you rescind your accusation that my script is to blame.

        Loading editor
    • Im sooooo sorry!!! This is my fualt I wrongly added semicolons to the script. I feel like a total jerk Im really sorry I got mad at you for no reason and to be honest I love your script its freaking awesome! 

        Loading editor
    • 452
    • Thanks again man your awesome! But hey is there any way to do this but instead of edits it would be like how long youve been apart of the wiki sense joining and something else like that but without any blocks or warnings for a year or 2 etc..

        Loading editor
    • Sorry if I've offended you earlier 452 Dx


      Is it possible to restrict using data from a specific namespace? For example, only using the stats of main namespace edit counts? Also, if that is possible, then is it doable to have multiple different tags showing for different namespaces? For example, a "social" type of level because some users are actively participating in forums and writing wall posts, but not really actually editing articles, that kind of stuff. Just wondering if the script can go to that level.

        Loading editor
    • 452

      Yes and yes, but:

      To do so you would have to query Special:Editcount (or the API, I haven't looked into it as it's not relevant to answering the question.) on every profile view.

      To me, adding an extra query on every profile view is an unacceptable increase in traffic, so I wouldn't do that.

      It's certainly an interesting idea, as I manually apply "Photographer" status to people who upload a lot of images. With your idea, it could be applied automatically for a user with a lot of edits in the File namespace.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+