Blog Activity Plugin

There were no instructions on how to add blog activity stats to your site (maybe this was only meant as a behind the scenes thing?)

Anyway i simply ripped the code from the plugin and posted it to my homepage and this is how i got it to work.

Sourcecode on homepage

<table width="100%">

<tr>

<?php

//


//

//---Page Output Functions


//

//


//

echo '<div class="wrap">';

switch( $_GET[ 'action' ] ) {

//


//

default:

$blog_activity_current_stamp = time();

$blog_activity_current_five_minutes = $blog_activity_current_stamp - 300;

$blog_activity_current_hour = $blog_activity_current_stamp - 3600;

$blog_activity_current_day = $blog_activity_current_stamp - 86400;

$blog_activity_current_week = $blog_activity_current_stamp - 604800;

$blog_activity_current_month = $blog_activity_current_stamp - 2592000;

//blog

$blog_activity_five_minutes = $wpdb->get_var("SELECT COUNT(*) FROM wp_blog_activity WHERE last_active > '" . $blog_activity_current_five_minutes . "'");

$blog_activity_hour = $wpdb->get_var("SELECT COUNT(*) FROM wp_blog_activity WHERE last_active > '" . $blog_activity_current_hour . "'");

$blog_activity_day = $wpdb->get_var("SELECT COUNT(*) FROM wp_blog_activity WHERE last_active > '" . $blog_activity_current_day . "'");

$blog_activity_week = $wpdb->get_var("SELECT COUNT(*) FROM wp_blog_activity WHERE last_active > '" . $blog_activity_current_week . "'");

$blog_activity_month = $wpdb->get_var("SELECT COUNT(*) FROM wp_blog_activity WHERE last_active > '" . $blog_activity_current_month . "'");

//post

$blog_activity_post_five_minutes = $wpdb->get_var("SELECT COUNT(*) FROM wp_post_activity WHERE stamp > '" . $blog_activity_current_five_minutes . "'");

$blog_activity_post_hour = $wpdb->get_var("SELECT COUNT(*) FROM wp_post_activity WHERE stamp > '" . $blog_activity_current_hour . "'");

$blog_activity_post_day = $wpdb->get_var("SELECT COUNT(*) FROM wp_post_activity WHERE stamp > '" . $blog_activity_current_day . "'");

$blog_activity_post_week = $wpdb->get_var("SELECT COUNT(*) FROM wp_post_activity WHERE stamp > '" . $blog_activity_current_week . "'");

$blog_activity_post_month = $wpdb->get_var("SELECT COUNT(*) FROM wp_post_activity WHERE stamp > '" . $blog_activity_current_month . "'");

//comments

$blog_activity_comment_five_minutes = $wpdb->get_var("SELECT COUNT(*) FROM wp_comment_activity WHERE stamp > '" . $blog_activity_current_five_minutes . "'");

$blog_activity_comment_hour = $wpdb->get_var("SELECT COUNT(*) FROM wp_comment_activity WHERE stamp > '" . $blog_activity_current_hour . "'");

$blog_activity_comment_day = $wpdb->get_var("SELECT COUNT(*) FROM wp_comment_activity WHERE stamp > '" . $blog_activity_current_day . "'");

$blog_activity_comment_week = $wpdb->get_var("SELECT COUNT(*) FROM wp_comment_activity WHERE stamp > '" . $blog_activity_current_week . "'");

$blog_activity_comment_month = $wpdb->get_var("SELECT COUNT(*) FROM wp_comment_activity WHERE stamp > '" . $blog_activity_current_month . "'");

?>

<td class="shorttd"><div class="gstarted2">

<div class="blogsbox">

<h3>Updated blogs in the last:</h3>

<p>Five Minutes: <?php echo $blog_activity_five_minutes; ?>

Hour: <?php echo $blog_activity_hour; ?>

Day: <?php echo $blog_activity_day; ?>

Week: <?php echo $blog_activity_week; ?>

Month*: <?php echo $blog_activity_month; ?>

</p>

</div></div></td>

<td class="shorttd"><div class="gstarted2">

<div class="blogsbox">

<h3>Posts in the last:</h3>

<p>Five Minutes: <?php echo $blog_activity_post_five_minutes; ?>

Hour: <?php echo $blog_activity_post_hour; ?>

Day: <?php echo $blog_activity_post_day; ?>

Week: <?php echo $blog_activity_post_week; ?>

Month*: <?php echo $blog_activity_post_month; ?>

</p>

</div></div></td>

<td class="shorttd"><div class="gstarted2">

<div class="blogsbox">

<h3>Comments in the last:</h3>

<p>Five Minutes: <?php echo $blog_activity_comment_five_minutes; ?>

Hour: <?php echo $blog_activity_comment_hour; ?>

Day: <?php echo $blog_activity_comment_day; ?>

Week: <?php echo $blog_activity_comment_week; ?>

Month*: <?php echo $blog_activity_comment_month; ?>

</p>

</div></div></td>

<?php

break;

//


//

case "remove":

break;

//


//

case "temp":

break;

//


//

}

echo '</div>';

?>

</tr>

</table></div>

</div>

is there any better way?