Please login or register to participate.
Blog Post

Visual "Poke-in-the-eye" when loged in as siteadmin

.

If you are anything like me, you would like to have a poke-in-the-eye notification that you are currently logged in as a site admin. In my office, siteadmin doesn't contribute with content, just manages the creation of spaces, deleting trash and basic site setup tasks. In such case, some of use ... a double login. Our own login, and a siteadmin login. To help us prevent leaving content as a siteadmin we implemented this script to show us that we are loged in as site admin:

<script type="text/javascript">
<!--
/* HELPFUL FUNCTIONS */
function is_siteadmin () {
$item =  $('img#myareaavatarimg').closest('a');
return ($item.attr('rel').length - $item.attr('rel').lastIndexOf('siteadmin') == 9);
}

/* RUN MAIN FUNCTION */
$(document).ready(function () {
if (is_siteadmin ())
  {
    /*COLOR BACKGROUND TO DARK RED TO MAKE IT MORE VISIBLE A SITE ADMIN IS LOGGED IN*/
    $('body')
        .css('background-image','none')
        .css('background-color','#882222');
  }
});
-->
</script>

Just go to Site Settings as siteadmin and copy-paste the above code to your JavaScript for web statistics support section.

Just thought to share this with people that wanna have this :)

 

Visual "Poke-in-the-eye" Site Admin

Description
How to instantly see that you are logged in as a site admin?
Comments (14)
hexbin Dec 07, 2009 03:34 PM
Feel free to leave opinions as well as "+1"/"-1"s :)
romasha Dec 07, 2009 04:08 PM
A screenshot of how it looks on your site would be cool! :)
apurva Dec 07, 2009 04:02 PM
A great idea! If people like the idea we could put this into the defaults. I could generate a red background image gradient just to comply with the convention.

Also wondering, wouldn't this be more efficient if we did it template side instead of JS?
hexbin Dec 07, 2009 04:29 PM
Well, it would... but as a simple PHP, JS programer, I did what I saw I could :)

Screen shoot coming up
romasha Dec 08, 2009 09:23 AM
Hello Hexbin,

This is really cool! I too am logged in our sites as the site admin multiple times and invariably end up posting. This is a great way to alert the user that s/he is logged in as an admin. Good job!

Rated +1 !!
iamlaozhao Dec 08, 2009 03:21 AM
Well done.

I agree with apurva, perhaps the admin's background color can be set as a parameter of site configuration.
hexbin Dec 08, 2009 11:17 AM
@romasha .... Thanks :)
@iamlaozhao... how ever developers plan to implement this in future (if they wish) is fine with me... I just found a quick solution that I know how to implement for this idea :) It even came to that that I almost wrote a script to make a floating box in a bottom right corner of a window to say something like "ADMIN LOGIN" :D... ofcourse in a big red letters :D... but thought that would be a bit overdoing it :)
iamlaozhao Dec 08, 2009 12:39 PM
Yes, your solution is very simple for any general users. I like your job.
dhiraj Dec 14, 2009 10:59 PM
Another jQuery trick! I like this idea as well. +1 :)

Potential flaw in this implementation, btw ( not a big one, though ) - this would only work for the siteadmin user, perhaps a better check would be to find the Administration link in the left navigation in your is_siteadmin() function.

Again, I agree with Apurva, this is off course better done with template and CSS changes / configuration setting, but at least you got it to work!

/me applauds.
hexbin Dec 15, 2009 12:20 PM
:D
Stuff I do hack for is for our in office scenario :) And I am just happy to share the concept ideas here :) Shure, alteration could be made to find the site admin link but...
My first reference in this script is by an item ID, which processes usualy faster then finding an item without an ID in a site. So I used this thing, that suits our office scenario perfectly since we have only 1 site admin account :)
hexbin Dec 15, 2009 12:21 PM
What the hell happend to image?
In my Cyn.in desktop it was rotated
and now it's gone?
hexbin Dec 15, 2009 12:27 PM
Ok, I guessed a new tester just tried to play around with content, and screwed this up :-\ Mabey createing a content editing lock where only creator and "editors" may edit content within a space? :-\
dhiraj Dec 15, 2009 12:38 PM
Hmm... I've reverted the image back to your original uploaded version.
The locking idea? Hmm... will think about it.
hexbin Dec 15, 2009 12:40 PM
think? I think you just been given a good argument and reasion for it :D
 
Loading