• Resolved g0hlj

    (@g0hlj)


    Before upgrading to EDD 3 on the Edit Download Product page, I was using a simple plugin which just shows me the total number of downloads for that product.

    Since EDD 3.0 it has stopped working now and the plugin author is no longer available.

    Has something changed in EDD 3 with regards to the code below

    global $edd_logs;
    
        $downloads =  $edd_logs->get_log_count( get_the_ID(), 'file_download' );
    	echo "Total Downloads: " . $downloads;
    • This topic was modified 2 years, 3 months ago by g0hlj.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Mihai Joldis

    (@misulicus)

    Hi @g0hlj

    Thanks for reaching out!

    We have this specific use case logged on our issue tracker as it is not working correctly in the latest version. We will have a fix for that in the 3.1 release of EDD.

    For now, it would be best to update the code to use 3.0 functions to retrieve the data.
    The code snippet below should work:

    
    /**
     * Get the number of times a download product has been downloaded.
     *
     * @param int $download_id
     * @return int
     */
    function ghlj_edd_get_file_download_logs_count( $download_id = 0 ) {
    
    	return edd_count_file_download_logs(
    		array(
    			'product_id' => intval( $download_id ),
    		)
    	);
    }
    echo "Total Downloads: " . ghlj_edd_get_file_download_logs_count( get_the_ID() );
    
    Thread Starter g0hlj

    (@g0hlj)

    Thankk you for the reply and I shall try that code

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘EDD Log Count For Downloads’ is closed to new replies.