Hi,
In my plugin Top 10, below is the code:
add_action('wp_head','tptn_add_viewed_count');
function tptn_add_viewed_count() {
global $post, $wpdb, $single;
$table_name = $wpdb->prefix . "top_ten";
$tptn_settings = tptn_read_options();
$current_user = wp_get_current_user();
$post_author = ( $current_user->ID == $post->post_author ? true : false );
if((is_single() || is_page())) {
echo '<!-- Top 10 : '.$current_user->ID.' & '.$post->post_author.' -->';
if (!(($post_author)&&(!$tptn_settings['track_authors']))) {
$id = intval($post->ID);
$output = '<script type="text/javascript" src="'.get_bloginfo('wpurl').'/wp-content/plugins/top-10/top-10-addcount.js.php?top_ten_id='.$id.'"></script>';
echo $output;
}
}
}
I have noticed that this doesn't work anymore, the $post->post_author and $current_user->ID both return blank values.
This wasn't a problem before I upgraded to 2.9. Can anyone else confirm this?