We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Hide stats to guests or members; Either/or
Topic Started: Jun 21 2010, 09:12 AM (1,367 Views)
VMSimon
Member Avatar
#clowns {float:left;} #jokers {float:right;} #me, #you {position:static;text-align:center;margin:auto;}
[ *  *  * ]
Well, I'm not 100% sure I personally would use this, but there are uses on certain types of forums.
--
To hide them to guests, add this to the Above the Copyright" box in board template.
Code:
 
<script>
var userlink = $('#top_info a:first').text();
if(userlink=="[Log In]"){
$('#stats').hide();
}
</script>

Alternatively, to hide them to Members.
Code:
 
<script>
var userlink = $('#top_info a:first').text();
if(userlink!="[Log In]"){
$('#stats').hide();
}
</script>
Edited by VMSimon, Jun 21 2010, 10:30 AM.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
Viral
[ *  *  *  *  *  * ]
Something you might want to do, to be reallly cautious, is, instead of checking the text == "[Log In]", check the URL. There is always the chance that a member could be called [Log In], or in a later update, the text may be changed to Log In, without the brackets, etc. It's better if the code works 100% of the time, rather than 99.9%. Check the URL of the login link and see if it has anything specific, that is notthere if you are logged in. You can't check to see if it contains /login/, as the logout link also has that text in the URL (when you're logged in). Maybe check to see if the URL has /logout, if it does; it's a member, if it doesn't; it's a guest.
Offline Profile Quote Post Goto Top
 
TheGrizzlyButcher
Member Avatar
Member
[ * ]
I'm sure I'm just missing something, but both codes look exactly the same.

What differentiates the two codes?
Offline Profile Quote Post Goto Top
 
Reid
Member Avatar
È una trappola!

Line two, == vs !=.

One hides stats from members, the other hides stats from guests.
Offline Profile Quote Post Goto Top
 
VMSimon
Member Avatar
#clowns {float:left;} #jokers {float:right;} #me, #you {position:static;text-align:center;margin:auto;}
[ *  *  * ]
Like this?
Code:
 
<script>
var userlink = $('#top_info a:first').attr('href');
if(userlink==main_url+'/login/'){
$('#stats').hide();
}
</script>
Offline Profile Quote Post Goto Top
 
Chule
Member Avatar
Member
[ * ]
good code, works fine on my board.
Offline Profile Quote Post Goto Top
 
rightside
Member Avatar
Member
[ * ]
thaknks mate, the one for guest works perfect on my forum :)

haven't tested the one for members.
Offline Profile Quote Post Goto Top
 
Real112288
Member Avatar
Member
[ * ]
The second code hides the stats from Admins as well
Offline Profile Quote Post Goto Top
 
tobeme
Member Avatar
Member
[ *  * ]
Is it possible to have these codes work on the portal as well?

I'm currently using the 'hide statistics from guest'. Although guests can't see the statistics on the index page but they can still see the statistics on the portal page.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
<script type="text/javascript">
if ($.zb.logged_in === false) $('#stats, #portal_foot').hide();
</script>
Try that to hide the portal stats as well.
Online Profile Quote Post Goto Top
 
tobeme
Member Avatar
Member
[ *  * ]
Brilliant! Thanks Cory.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply