[Plugin: FeedStats] Please include function to only return average subscribers
-
Hey there,
again, thank you for this great plugin!
Here’s a quick hack I added to my functions.php to only return the average subscriber count, as I don’t need the badge. It would be awesome if you could include this to your main functions:
function get_feedstats_getfeeds_average() { $count = get_transient('get_feedstats_getfeeds_average'); if ($count !== false) return $count; $count = 0; global $wpdb; $total_visits = $wpdb->get_var("SELECT count(*) FROM " . $wpdb->prefix . 'fs_visits'); $total_visits = htmlspecialchars($total_visits, ENT_QUOTES); $time = time(); $time_begin = feedstats_get_midnight( $wpdb->get_var("SELECT time_install FROM " . $wpdb->prefix . 'fs_data') ); $num_days = ceil( ($time-$time_begin) / FEEDSTATS_DAY ); if ( $num_days > get_option('fs_days') ) { $num_days = get_option('fs_days') + 1; } $average_visits = ($num_days) ? ( round( $total_visits / ($num_days) ) ) : '0'; $average_visits = htmlspecialchars($average_visits, ENT_QUOTES); set_transient('get_feedstats_getfeeds_average', $average_visits, 60*60*1); return $average_visits; }
Yours,
– Ben
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: FeedStats] Please include function to only return average subscribers’ is closed to new replies.