GuildPortal will be going offline (permanently) by the end of the month.
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
Mottie (MVP) 2/21/2011 12:50 PM EST : Widget Access Levels
GuildPortal MVP
Posts: 3884
Zomgawsh Poster

Widget Access Levels

This script will allow you to have a widget that is only visible to guild members or one only visible to officers, etc. Essentially, you hide ALL of your widgets, then this code will sort through the titles to find matches, then figure out which ones to show.

The main problem with this script is that if someone knows what to look for, they can find and view this hidden information. So it's not perfect. The best place for information you don't want visible to others would be to add an entire page only visible to users with that access level.

  • CSS: Add the following css to your custom css (Control Panel > Custom HTML & Script > Custom CSS > CSS Additions to Standard). It will hide all of the widgets on your page.
    .gpWidget { display: none; }
  • Script: Add this script to your custom script area (Control Panel > Custom HTML & Script > Custom Javascript/JQuery > Additional Functions tab). Make sure the "Enabled?" box is checked before clicking [ Save ].
     // Enter Widget title then in parenthesis include the access level number
     // One widget:  "Title(#)" // the "#" in parenthesis is the access level number of that widget
     // Two widgets: "Title 1(#), Title 2(#)" // separate the titles with a comma
     // The title must EXACTLY match the widget title before this script will work
     // access level: public = 1, associate = 1.5, member = 2, council = 2.5, officer = 3, super admin = 4

     var widgetAccess = "Voice Chat (2), Contact Info(2), Council Updates(2.5), Officer Updates (3)"

     /* Don't change anything below */
     ,accessIt = function(cb, t, h){
      if (!cb.length) { return; }
      h = h || 1; // no access level = make public
      var access = parseInt("$block[userlevelnumber]".replace(/\s+/,''),10);
      if (access >= h) {; }
     }, a = [], j, n = [], t, list = widgetAccess.split(',');
     for ( j=0; j < list.length; j++ ){
      t = list[j].match(/([^(]*)\(([^)]*)/);
      n.push($.trim(t[1])||''); // widget name
      a.push($.trim(t[2])||1); // access level
      t = $.trim( $(this).find('.ContentBoxTitle,.ContentBoxTitleNoBackground').text() );
      j = $.inArray(t,n);
      if (j < 0 || widgetAccess.indexOf(t) < 0) {
      } else {
       accessIt($(this), n[j], a[j]);

Modify the "widgetAccess" varible to add specific widgets that need an access level. Follow this template:
var widgetAccess = "Title1(#), Title2(2)"
  • The "Title" in blue must EXACTLY match the widget title, spaces included.
  • The access level must be wrapped in parenthesis and follow the title.
  • Access Levels are as follows:

    • public = 1
    • associate = 1.5
    • member = 2
    • council = 2.5
    • officer = 3
    • super admin = 4

  • Add more titles by separating each one with a comma

Kaysi (Guild Admin) 1/14/2012 4:47 PM EST : RE: Widget Access Levels
Posts: 445
Fingers of Fury!


I have installed the MOD, altered the code. Our Guild Leader only wants the Welcome box to show to public level viewers. When I log off to test the page, the welcome box is viewable for a flash and then it vanishes.

Where did I mess up?

Thank you very much for your time and help!!!!



Mottie (MVP) 1/14/2012 7:32 PM EST : RE: Widget Access Levels
GuildPortal MVP
Posts: 3884
Zomgawsh Poster

Hi Kaysi!

Actually, it looks like you modified your content box custom code, because the "Welcome" is followed by a "&nbsp;", so try this:
var widget_access_levels = "Welcome&nbsp;(1)"

Kaysi (Guild Admin) 1/15/2012 10:48 AM EST : RE: Widget Access Levels
Posts: 445
Fingers of Fury!

Once again you save the day!!

You are the BEST!!!! Thank you!!!

For you <3


Mottie (MVP) 1/15/2012 3:08 PM EST : RE: Widget Access Levels
GuildPortal MVP
Posts: 3884
Zomgawsh Poster

MMM cookies!!!!!

But sadly, I think this mod is broken... there seems to be a problem with using the block code inside of a mod. I've submitted a support ticket so hopefully it will get fixed soon.

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