Recent Topics

1 Jan 18, 2007 06:12    

We have removed the "Who's Online" from our main page we would though as adminstrators like to have a sneaky way of seeing who is online. Is that possible?

2 Jan 18, 2007 06:50

Who are your administrators? If that's really only one person then it's easy. If the only registered bloggers you have are administrators is also easy. If you actually have administrators and bloggers it gets a little more complex. Either way, add the "who's online" block back in, only wrap it in a conditional statement or two.

If ALL the registered bloggers happen to be administrators then do like this:

<?php if( is_logged_in() ) {
	if( empty($generating_static) && ! $Plugins->trigger_event_first_true('CacheIsCollectingContent') )
	{ // We're not generating static pages nor is a caching plugin collecting the content, so we can display this block
		// TODO: when this gets a SkinTag plugin this check should get done by the Plugin
		?>
	<div class="bSideItem">
		<h3 class="sideItemTitle"><?php echo T_('Who\'s Online?') ?></h3>
		<?php
			$Sessions->display_onliners();
		?>
	</div>
	<?php }
} // end is_logged_in ?>

If the only admin is ID #1 then it's easy but takes another pair of lines:

<?php if( is_logged_in() ) {
if( $current_User->ID == 1 ) {
	if( empty($generating_static) && ! $Plugins->trigger_event_first_true('CacheIsCollectingContent') )
	{ // We're not generating static pages nor is a caching plugin collecting the content, so we can display this block
		// TODO: when this gets a SkinTag plugin this check should get done by the Plugin
		?>
	<div class="bSideItem">
		<h3 class="sideItemTitle"><?php echo T_('Who\'s Online?') ?></h3>
		<?php
			$Sessions->display_onliners();
		?>
	</div>
	<?php }
} // end is user #1
} // end is_logged_in ?>

If you've actually got an admin group AND have registered members who are not part of that group AND that group happens to be group #1 then it's sorta like the above bit only different.

<?php if( is_logged_in() ) {
if( $current_User->Group->ID == 1 ) {
	if( empty($generating_static) && ! $Plugins->trigger_event_first_true('CacheIsCollectingContent') )
	{ // We're not generating static pages nor is a caching plugin collecting the content, so we can display this block
		// TODO: when this gets a SkinTag plugin this check should get done by the Plugin
		?>
	<div class="bSideItem">
		<h3 class="sideItemTitle"><?php echo T_('Who\'s Online?') ?></h3>
		<?php
			$Sessions->display_onliners();
		?>
	</div>
	<?php }
} // end is member of group #1
} // end is_logged_in ?>

Or maybe I nade this up in my head just now and none of it will actually work.

3 Jan 18, 2007 16:30

Cool. I was guessin that I was out of luck. We have two Administrator and the rest will be registered members. I'd like the other Admin to have this feature as well. Can I just somehow add his ID into the second option?

4 Jan 18, 2007 21:48

if( ($current_User->ID == 1) || ($current_User->ID == 123456789) ) { 


It'd be smarter to add your other admin to the admin group because if you ever have a third admin you won't have to re-hack this, but there you go.

5 Jan 18, 2007 22:17

Right. Got it. Thanks EdB.


Form is loading...