Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : Tooltips & Popups > Access Level Popup Messages
Mottie (SuperAdmin) 7/22/2010 6:00 PM EST : Access Level Popup Messages
ACK!
Mottie
Posts: 3884

0
Like

0
Dislike

Access Level Popup Messages

GuildPortal admin site link to the original post

This script allows you to add a popup message (growl) that will show a different message depending on the user's access level (i.e. one message for the public, one for associates and another for members, etc.).

Code
Add the following code into a free form text/HTML widget on the page you want to display the growl message or add it to the footer to show on every page (but it's more annoying)
<!-- *** Popup message for different access levels *** -->
<div style="display: none">

<!-- PUBLIC -->
<div class="message-public">
 Public Message Here<br>
 <img src="my-image.jpg" />

</div>

<!-- ASSOCIATE -->
<div class="message-associate">
 Associate Message Here<br>
 <img src="my-image.jpg" />
</div>

<!-- MEMBER -->
<div class="message-member">
 Member Message Here<br>
 <img src="my-image.jpg" />

</div>

<!-- COUNCIL/OFFICER/ADMIN -->
<!-- leave div empty to not display a message -->

<div class="message-council message-officer message-superadmin"></div>

</div>
<script type="text/javascript">
$(document).ready(function(){
 // Change the amount of time the popup is shown in milliseconds (5000 = 5 seconds)
 $.growl.settings.displayTimeout = 5000;
 // Don't change anything below
 var access = "$block[userlevelname]".replace(/\s+/,'');
 var content = $.trim($('.message-' + access).html());
 if (content.length){ growl('', content); }
});
</script>
Customizing
  • Timing - Change the amount of time the growl popup is displayed by modifying the time in red (in milliseconds)
     // Change the amount of time the popup is shown in milliseconds (5000 = 5 seconds)
     $.growl.settings.displayTimeout = 5000;
  • Message - Replace the contents in blue above to change the message for each access level.
    <!-- PUBLIC -->
    <div class="message-public">
     Public Message Here<br>
     <img src="my-image.jpg" />

    </div>
  • Access Level Messages - The "message-{level name}" class for the specific access level is displayed. You can add individual messages for each level (like the Message example above) or combine them together as seen in the council/officer/admin block in the code.
    <!-- COUNCIL/OFFICER/ADMIN -->
    <div class="message-council message-officer message-superadmin">
    We Rock!
    </div>
  • No Message - Leave the contents of the <div> empty or don't add the "member-{level name}" class.
    <div class="message-superadmin"></div>
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%