Problem seems to be with your SQL queries and not where your plugin is located.
As Lynne pointed out you call $group but it doesn't seem to be defined anyways, I doubt it was stored globally, but I'm not sure.
I don't even know what that code means!!
It worked when i put it on the Ultimate Site Columns, but doesn' work now. Hmm, i'm a begineerin with the ocde stuff, don't know anything lol.
I might just have to remove it all. The only think is its usefull if the staff who are online are shown, but i guess they can be shown and are show in the whos online bit.