Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Voodoo Tech and Scripter's Den of Scriptniquity > Hiding the Shout Box from Non-Members
Mottie (MVP) 1/14/2010 7:05 AM EST : Hiding the Shout Box from Non-Members
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Innocandy asked me on my Help-Site forums about doing this, so I'm adding the code here as well.

Hiding the Shout Box from Non-Members

This script reveals a hidden shout box. So what that means is anyone can view the page source and still see the shout box contents... if you want to completely remove the shout box, then that will take another bit of coding (included at the end).

Coding
To start out, you will need to hide te shout box. The CSS at the top of the code does that. while the script will reveal the code if it doesn't find a link to join the site. Add the complete code below to your Footer Area (Control Panel > Custom HTML & Script > Footer Area).
<!-- *** Reveal shout box if the link to join the site doesn't exist *** -->
<style type="text/css">
 .gpWidget-shout { display: none; }
</style>
<script type="text/javascript">
$(document).ready(function(){
 var accessLevel = "$block[userlevelname]";
 if (!accessLevel.match('public|associate')) $('.gpWidget-shout').show();
})
</script>
If you want to completely remove the shoutbox (personal preference I guess), then add this code:
<!-- *** Reveal shout box if the link to join the site doesn't exist, otherwise remove it *** -->
<style type="text/css">
 .gpWidget-shout { display: none; }
</style>
<script type="text/javascript">
$(document).ready(function(){
 var accessLevel = "$block[userlevelname]";
 if (accessLevel.match('public|associate')) {
  $('.gpWidget-shout').remove();
 } else {
  $('.gpWidget-shout').show();
 }
})
</script>
Customizing
  • Modify the access level by changing the code in blue. Any additional access level names should be separated with a pipe "|" (shift-\, above the enter key on the keyboard). Here are some examples:

     Access Levels 
        
     Hide Shout box from  Code
      Public
      Associate
      Member
      Council
      Officer
      Super Admin
       Public  'public'
       Public & Associates  'public|associate'
       Public, Associates & Members  'public|associate|member'

  • The code is using a new variable "$block[userlevelname]" which provides the access level name in lower case.
Edit (1/22/2010): Updated the code to look for "membership is pending review" in the top menu and if found, it won't show the shout box. NOTE: this feature doesn't work if you are using a Navigation type of "Content Box - Left Side, Center or Right Side".
Edit (1/31/2010): Updated to use the new $block code that provides the user access level.
TopBottom

Mottie (MVP) 1/31/2010 6:35 PM EST : RE: Hiding the Shout Box from Non-Members
GuildPortal MVP
Mottie
Posts: 3884
Zomgawsh Poster

Updated to use the new $block variable.
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%