Forum:Inactive tag

Is there anyway to add an "Inactive" tag like the "Admin" tag for any users who hasn't been editing the wiki for 72 days and has at least 1 contribution in Isle of Tune Wiki? If you don't understand, please reply &mdash;  S a m  Wang  12:31, April 6, 2012 (UTC)
 * I don't know of a way to make it on the top bar, but I'm sure with a template it's possible. I know how to do at least 1 contribution:

Although you'd have to add a script that gives days since last edit on Template:Lastedit. I know a way you could possibly do it, but you'd have to add a code to every page on the wiki. Let me know if that's okay and I can start working on it. Iggyvolz 12:49, April 6, 2012 (UTC)
 * Sorry...I gave some administration rights out to Pecoes because he said he can help with some MediaWiki stuff that I want, and I've just left a message on his wall asking if he can answer this forum, but he said this might need Special:Contact, so possibly just leave it like this right now &mdash;  S a m  Wang  12:53, April 6, 2012 (UTC)


 * I did not suggest to contact Special:Contact over this. You bombarded me with questions, so I said I don't have the time to answer all of them. --

Having said that... This is actually a very interesting idea, Sam! This is what I would suggest:

$(function {   var m, userName = false;    if (-1 != [2,1200,3,500,501].indexOf(wgNamespaceNumber) && (m = wgPageName.match(/(?:\:|%3[aA])([^\/]+)/))) {        userName = m[1];    } else if (-1 != 'Following Contributions'.indexOf(wgCanonicalSpecialPageName)) {        userName = wgUserName;    }    if (userName) {        function ISODateNDaysAgo (days) {            function pad (n) { return n < 10 ? '0' + n : n; }              function ISODateString (d) {                  return    d.getUTCFullYear + '-'                      + pad(d.getUTCMonth+1) + '-'                      + pad(d.getUTCDate)    + 'T'                      + pad(d.getUTCHours)   + ':'                      + pad(d.getUTCMinutes) + ':'                      + pad(d.getUTCSeconds) + 'Z';            }            return ISODateString(new Date(Date.now - days * 24 * 60 * 60 * 1000));        }        var apiUrl = '/api.php?action=query&list=usercontribs&uclimit=1&ucprop=title|timestamp&format=json' + '&ucuser=' + userName + '&ucstart=' + ISODateNDaysAgo(0) + '&ucend='  + ISODateNDaysAgo(3 * 30); $.getJSON(apiUrl, function (result) {           if (typeof result.query != 'undefined' && typeof result.query.usercontribs != 'undefined' && !result.query.usercontribs.length) {               $(' inactive ').appendTo('#UserProfileMasthead hgroup').css({ backgroundColor: 'rgb(180,180,180)', color: 'rgb(80,80,80)' });           }        });    } });

It adds a tag "INACTIVE" to the masthead of user pages, user talk pages, message walls, user blogs, user blog talk pages, Special:Following and Special:Contributions of any user who hasn't made any edit of any sort in the last three months.

Test it a little and tell me what you think, please! --
 * Thanks! &mdash;  S a m  Wang  03:19, April 7, 2012 (UTC)
 * However, oddly, people who did not yet make any edits seems to have an inactive tag, and is it possible to make the background color and text color to be like the other tags? &mdash;  S a m  Wang  03:22, April 7, 2012 (UTC)

I'll start with the second question because that's simple: Just remove the CSS rules for the tag. Replace this:

$(' inactive ').appendTo('#UserProfileMasthead hgroup').css({                   backgroundColor: 'rgb(180,180,180)',                    color: 'rgb(80,80,80)'                });

with this:

$(' inactive ').appendTo('#UserProfileMasthead hgroup');

Users who never made any edits don't get any special treatment yet. I'm not sure what to do with them... You're right, it's incorrect to call them "inactive", but they aren't active either, are they? How about a label "guest"? No, wait, "guest" is inaccurate as well. Maybe "external" sums it up? --


 * Well, let's leave that question aside for a moment. I changed the code so that users with no edits will no longer be labeled as inactive. I also removed the CSS, but added a class  to the tag. Should you ever want to style the tag, you can simply create a rule for this class. --
 * Thanks so much! &mdash;  S a m  Wang  07:20, April 7, 2012 (UTC)

For the sake of reference: This is the final version:

$(function {   if (!$('#UserProfileMasthead').length) return;    if (!parseInt($("#UserProfileMasthead .tally").text)) return;    var userName  = $("#UserProfileMasthead h1").text;    function ISODateNDaysAgo (days) {        function pad (n) { return n < 10 ? '0' + n : n; }          function ISODateString (d) {              return    d.getUTCFullYear + '-'                  + pad(d.getUTCMonth+1) + '-'                  + pad(d.getUTCDate)    + 'T'                  + pad(d.getUTCHours)   + ':'                  + pad(d.getUTCMinutes) + ':'                  + pad(d.getUTCSeconds) + 'Z';        }        return ISODateString(new Date(Date.now - days * 24 * 60 * 60 * 1000));    }    var apiUrl = '/api.php?action=query&list=usercontribs&uclimit=1&ucprop=title|timestamp&format=json' +                 '&ucuser='  + userName +                 '&ucstart=' + ISODateNDaysAgo(0) +                 '&ucend='   + ISODateNDaysAgo(3 * 30); $.getJSON(apiUrl, function (result) {       if (typeof result.query != 'undefined' && typeof result.query.usercontribs != 'undefined' && !result.query.usercontribs.length) {           $(' inactive ').appendTo('#UserProfileMasthead hgroup');        }    }); });


 * You should consider adding that to the Developers Wiki. Iggyvolz 13:26, April 7, 2012 (UTC)

1. How about for a certain user even though it hasn't reached 3 months not editing yet? 2. Can you make it so an admin with an inactive tag will remove the tags and replace it with "Inactive Admin"? Sam Wang (talk) 11:53, April 28, 2012 (UTC)
 * Done. --
 * I have two additional questions:
 * It should say "INACTIVE" and "ADMIN", but if an admin hasn't edited in months, they probably shouldn't be admin (with a few exceptions, like staff). Iggyvolz 21:50, April 28, 2012 (UTC)


 * How about adding a configuration setting to tag users as "INACTIVE" immediately? You could use that in cases where users want to quit the wiki or somesuch. --

What do you mean? Sam Wang (talk) 12:18, April 30, 2012 (UTC)
 * It would appear they're asking if it would be possible to have it automatically say "INACTIVE" immediately if the user decides to go inactive through some form of configuration. 16:01, April 30, 2012 (UTC)