Support Forums / Script repository / Archives / 12-06-2008 / Hide Statistics for guests, display for members *

Topie: Hide Statistics for guests, display for members *
May 9th, 2006 10:56 AM
Sage so, yeah...I just coded this up. :)

*warning*
this will only work if you did not edit the login form (Username, or Password), and that you stats still have "A total of # posts have been made. "

you can have it 2 ways...

have the statistics hidden...



which the code would be:

Quote:

<script language="javascript">
<!--
//Hide Statistics for Guests, display for members
//Written by Dranew <http://s2.excoboard.com/exco/index.php?boardid=13054>
//Place in footer

var td = document.getElementsByTagName('td')

for(i=0;i<td.length;i++) {
for(s=0;s<td.length;s++) {
if(td[s].className=="FirstAlt" && td[s].width=="100%" && td[s].innerHTML.indexOf('posts have been made') != -1) {
if(td[i].innerHTML.indexOf('Username' || 'Password') != -1) {
td[s].style.display = "none"
}
}
}
}

//-->
</script>


or have it with a message:



and that code would be:

Quote:

<script language="javascript">
<!--
//Hide Statistics for Guests and display message, display for members
//Written by Dranew <http://s2.excoboard.com/exco/index.php?boardid=13054>
//Place in footer

var td = document.getElementsByTagName('td')

for(i=0;i<td.length;i++) {
for(s=0;s<td.length;s++) {
if(td[s].className=="FirstAlt" && td[s].width=="100%" && td[s].innerHTML.indexOf('posts have been made') != -1) {
if(td[i].innerHTML.indexOf('Username' || 'Password') != -1) {
td[s].innerHTML = "<span class=NormalText>You must Login to view the statistics!</span>"
}
}
}
}

//-->
</script>


and as always...
Live Preview
(Edited by Sage)
(Edited by Sage)
(Edited by Sage)
May 9th, 2006 11:45 AM
fin24000 Cool I relly like the 2nd one :)
May 9th, 2006 12:06 PM
Sage :) thanks!
The second onw is my favorite :)
May 10th, 2006 06:19 PM
Princess29 I like the 2rd but where do I stick the code?
May 10th, 2006 10:56 PM
Sage Feature settings > Footer :)
May 10th, 2006 11:46 PM
Koyana Nuva Very nice, Sage. I'm gonna have to top that!
May 10th, 2006 11:48 PM
Sage are we compeating? :S hehe ^_^ thanks! :)
May 11th, 2006 10:15 AM
Princess29 Thanks..
May 11th, 2006 05:07 PM
Koyana Nuva
Quote:
Sage wrote:
are we competing? :S hehe ^_^ thanks! :)


Okay, Sage. I'm coming up with a script that should blow your pink programming socks off! ^^D You're gonna be impressed, at least that's what I'm going for...
May 13th, 2006 01:40 PM
fin24000 Can you tell me how I would add a login and Register link to it?
May 13th, 2006 03:18 PM
Koyana Nuva
Quote:

<a href="register.php?boardid={boardid}">Register</a> | <a href="profile.php?boardid={boardid}">My Account</a>
May 13th, 2006 03:20 PM
Koyana Nuva OR this...
Quote:

<script language="javascript">
<!--
//Hide Statistics for Guests and display message, display for members
//Written by Dranew <http://s2.excoboard.com/exco/index....p?boardid=13054>
//Place in footer

var td = document.getElementsByTagName('td')

for(i=0;i<td.length;i++) {
for(s=0;s<td.length;s++) {
if(td[s].className=="FirstAlt" && td[s].width=="100%" && td[s].innerHTML.indexOf('posts have been made') != -1) {
if(td[i].innerHTML.indexOf('Username' || 'Password') != -1) {
td[s].innerHTML = "<span class=NormalText>You must Login to view the statistics!</span>"
}
}
}
}
<tr>
<td class="FirstAlt"><!-- BEGIN iftrue_logincode -->
<table border="0" cellpadding="0" cellspacing="2"><form action="index.php" method="post">
<tr>
<td><span class="SmallText"><b>Username</b></span></td>
<td><span class="SmallText"><b>Password</b></span></td>
<td rowspan="2" valign="bottom"><input type="submit" class="SubmitButtons" value="Login" name="B1"></td>
</tr>
<tr>
<td><input type="text" class="TextInputField" name="fieldusername" size="10"></td>
<td><input type="password" class="TextInputField" name="fieldpassword" size="10"></td>
</tr>
<input type="hidden" name="action" value="login"><input type="hidden" name="boardid" value="{boardid}"></form></table>
<!-- END iftrue_logincode -->
<!-- BEGIN newpm -->
<span class="SmallText">
<a href="pm.php?boardid={boardid}"><b>Private Messages</b></a>: You have <b>{newpm.newpms}</b> unread messages</span>
<!-- END newpm -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<a href="register.php?boardid={boardid}">Register</a>
//-->
</script>
May 16th, 2006 12:56 AM
Catchow Dranew,

Very nice! I especially like how you have provided two options. I hope that you added it to the index.

Koyana Nuva

There is no need for competion here. Dranew (Sage) has been here from near the beginning of Exco and has always been of the mind to help improve Exco. He simply isn't the competitive type and we don't really need or want "competions" here. If you can improve the coding, by all means feel free to do that but there is no need to blow your own horn. There is also no need for all your double and triple postings. Please use the edit button.

May 16th, 2006 11:02 AM
rodent Nice code Dranew :) no need for competition people. Just work for the communiy :) i would love to beable to do what you guys can do, i know some of the basics, keep up the good work you two :) and the rest of you theres some really good scripts around :)
May 16th, 2006 08:04 PM
Koyana Nuva I know. The whole competition was a joke that went a little too far. Sorry, guys! ^^D ... But it did kinda work out. We got more scripts faster. I apologize to Sage if I offended him or anything...

Man, I'm breakin' the rules today! ^^D
May 17th, 2006 11:00 PM
KsTornado11 I tried the second one, but I ended up w/ the "you must log in" although I WAS logged in.. where did I screw up?
May 18th, 2006 06:19 PM
Sage
Quote:
Koyana Nuva wrote:
I know. The whole competition was a joke that went a little too far. Sorry, guys! ^^D ... But it did kinda work out. We got more scripts faster. I apologize to Sage if I offended him or anything...

Man, I'm breakin' the rules today! ^^D


haha none taken :) the joke was actually amusing :p



KsTornado11: may I see a preview of the script you used?
(Edited by Sage)