• Resolved raymer

    (@raymer)


    I’m having the same problem that mia is having – stats aren’t showing any data. But I am also having a more basic problem (which is probably related) and so I thought I would start a new thread.

    In the podpress general settings, setting “Show Download Stats” to enabled doesn’t seem to do anything. I think in old versions of podpress that I used it wrote the number of downloads out after the download link in the post. That hasn’t happened for the last several versions. Sorry I can’t remember exactly which version I last saw it work in.

    How do these stats work, do they require write access to the plugin dir? Do they use the db?

    Thanks,
    Ray

Viewing 16 replies (of 16 total)
  • Thank you for the compliment!

    To log also the db error messages add some further lines in the podpress_function.php:

    for Counts Only:

    function podPress_StatCounter($postID, $media, $method) {
    		global $wpdb;
    		switch($method) {
    			case 'feed':
    			case 'web':
    			case 'play':
    				$sqlIoU = "INSERT INTO ".$wpdb->prefix."podpress_statcounts (postID, media, $method) VALUES ($postID, '$media', 1) ON DUPLICATE KEY UPDATE $method = $method+1, total = total+1";
    				printphpnotices_var_dump($sqlIoU);
    				$result = $wpdb->query($sqlIoU);
    				printphpnotices_var_dump($result);
    				ob_start();
    				$wpdb->show_errors();
    				$wpdb->print_error();
    				$err_msg = ob_get_contents();
    				ob_end_clean();
    				printphpnotices_var_dump($err_msg);
    				break;
    			default:
    				return;
    		}
    	}

    If it is a multi site blog then add to the wp-config.php the conatnt ERRORLOGFILE and define the absolute path to the error log file e.g.
    define( 'ERRORLOGFILE', '/htdocs/myblogname/wp-content/plugins/podpress/errorlog.dat' );.

    For the Full logging method:
    the end of the podPress_StatCollector() function should look like this:

    printphpnotices_var_dump($query);
    		$result = $wpdb->query($query);
    		printphpnotices_var_dump($result);
    		ob_start();
    		$wpdb->show_errors();
    		$wpdb->print_error();
    		$err_msg = ob_get_contents();
    		ob_end_clean();
    		printphpnotices_var_dump($err_msg);
    		return $wpdb->insert_id;

    BTW: I’m testing with a multi site installation and the WP ERRORLOGFILE shows that the backslashes you can see in the query string in the printphpnotices log file are not in the actual query string.

Viewing 16 replies (of 16 total)
  • The topic ‘[Plugin: Podpress] "Show Download Stats" not working’ is closed to new replies.