Support » Plugins » [Plugin: Download Monitor] PHP error with all download links

Viewing 6 replies - 1 through 6 (of 6 total)
  • Interested in the answer to this as well.

    Ok, seriously no one else is having this issue?

    I’m running the most recent version of the plugin and WP 3.1.1 on the live site now and I can manually link to uploaded files, but anytime I try to use a button, shortcode, or link created by the plugin I get that error.

    See here for an example:

    Actual file:

    And here’s the downloads page (no longer in use, just for troubleshooting this):

    Thanks for any help, suggestions, or screaming that anyone has.

    I had the same problem with the error-message “Fatal error: Cannot redeclare…”
    I found my own solution to it.

    As the error says, A function called “X” is already declared and cannot be declared again. So i opened up the shortcodes.php file and started to look for all these functions giving me errors.

    My solution
    The solution to the problem for me was to write some code to check if the function has been declared or not. If it is declared then don’t declare it again, if not – do it!

    If you know some PHP-coding you can do it your own for each function like this:

    This is the first function and its block of code that generate an error from shortcodes.php (The name of the function is wp_dlm_get_total_downloads() ):

    function wp_dlm_get_total_downloads() {
    		global $wpdb, $wp_dlm_db;
    		return $wpdb->get_var('SELECT SUM(hits) FROM '.$wp_dlm_db.';');
    	add_shortcode('total_downloads', 'wp_dlm_get_total_downloads');
    	function wp_dlm_get_total_files() {
    		global $wpdb, $wp_dlm_db;
    		return $wpdb->get_var('SELECT COUNT(*) FROM '.$wp_dlm_db.';');
    	add_shortcode('total_files', 'wp_dlm_get_total_files');

    We need to add this code to this specific block of code/function:


    In the example above we check to see if the function “wp_dlm_get_total_downloads” has not been declared earlier. If it has we simply don’t run it. If not we trigger it!

    More errors?
    When you have saved your changes to the shortcodes.php and checked your site to get the next function error, cause you will get new ones. :-/
    Repeat the process for that new function error:

    If you’re lazy or think that what I wrote above is greek, you can download my own modified file shortcodes.php) here: Download the modified file

    Remember that if you autoupdate the plugin with a new released version, all these changes will be gone!

    That worked perfectly, thanks for sharing!

    Thanks man! I had this problem too. it makes my head so pain. With your solution i fixed all functions in the shortcodes.php file, it works, i just don’t know why!

    Seriously, this has busted 2 client sites in recent memory.
    The plugin author has to roll this into the next release!

    Thanks chrisanthropic for the fix.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Download Monitor] PHP error with all download links’ is closed to new replies.