Board Logo

 Username:    Password:    Stay logged in: Welcome Guest. Please Login or Register.  May 23rd, 2017, 12:04pm


Board Hacks
Important News
Please read the notes posted with any codes carefully, as they will usually tell you where they need to go.
Welcome to the Conforums Hacks Board!

All codes here have been tested but we accept no responsibility if these codes do not work on your board, or have an adverse effect when used in combination with other codes.

This board is read only. Any queries or requests for codes should be made on the Coding Forum

Helpful sites
Google
Dynamic Drive

The Staff
Roger
Dave
GIzzy



« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Number of Admins/Gmod/Mods in users online box  (Read 2977 times)
Dave
I've always wanted one of these wink
Conforums Administrator


member is offline

Avatar

Mr Fixit...


Homepage PM

Gender: Male
Posts: 17634
xx Number of Admins/Gmod/Mods in users online box
« Thread started on: Dec 16th, 2003, 4:11pm »


This code requires 2 seperate pieces of code...

I've seperated them out, so the first one (with a little tweak, gives coloured usernames etc...) assigns users a class... such as
  • adminuser for admins..
  • gmoduser for gmods..
  • moduser for moderators..
( This is the actual script that we use here to give coloured usernames ).

So this goes into all footers..:- Code:
<script language="javascript" type="text/javascript">
<!--
// add classnames to staff

function doitnow(user,classuser) {
for(var a=0;a<document.links.length;a++)
if(document.links[a].href.indexOf('viewprofile&username='+user) != -1 )
document.links[a].className=classuser;
}

doitnow("admin","adminuser");
doitnow("Dave","adminuser");
doitnow("Gizzy","adminuser");
// -->
</script> 


I've left in the usernames, so you can see who to add/remove more...

Then in just the main footer, after the code above:- Code:
<script language="javascript" type="text/Javascript">
<!--
/*
Show staff online
Dave - Conforums.com
*/

var usercell = document.getElementById('info_center').getElementsByTagName('FONT')[7];
var adon="", gmon="", mon="", uon="", swuser="", uclass="", utype="";
var onuser = usercell.getElementsByTagName('A')

function adduser(type,userlink,userclass,profuser){
utype= (type!="") ? ", " : "";
uclass = (userclass != "") ? ' class="'+userclass+'"' : '';
return utype+'<a href="index.cgi?action=viewprofile&username='+profuser+'"'+uclass+'>'+userlink.innerHTML+'</a>';
}

var usertype = document.getElementById('info_center').getElementsByTagName('FONT')[7].innerHTML.split(/<br>/i)[0].split(/,/)[0]
if(usertype.match(/^1 guest/i))
usertype = "1 Guest";

for(on=0; on<onuser.length; on++){
onuser[on].href.match(/username=(\w+)/i);
swuser = RegExp.$1;
switch (onuser[on].className){
case "adminuser":
adon += adduser(adon,onuser[on],"adminuser",swuser); break;
case "gmoduser":
gmon += adduser(gmon,onuser[on],"gmoduser",swuser); break;
case "moduser":
mon += adduser(mon,onuser[on],"moduser",swuser); break;
default:
uon += adduser(uon,onuser[on],"",swuser); break;
}}

if(adon!="")adon="Administrators: "+adon
if(gmon!="")gmon="<br />Global Moderators: "+gmon
if(mon!="")mon="<br />Moderators: "+mon
if(uon!="")uon="<br />Members: "+uon
usercell.innerHTML=adon+gmon+mon+uon+"<br />"+usertype;

// -->
</script> 

You don't need to modify this second code in any way... it uses information from the first code...

Let me know how you get on....





As of the recent update, there is no need to specify classnames for admin and global moderators..
« Last Edit: Jun 4th, 2010, 02:03am by Dave » User IP Logged

Have you read the FAQ or checked the Hacks board before posting?
No?
Then please do so...
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Back To Top
Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls