CoursePress Certificate Not Working

After a student completes their course, they are given the option to download their certificate. However when you click on it, you are given a message "Something went wrong." and you are not able to download the certificate. Everything is up-to-date and already tried running the default template to see if that fixed it and no luck. However I should say you can see the Preview when you're customizing the certificate. Also should note I tried using the basic coursepress one too and no luck either.

    James Morris

    Hello Nathan,

    I'm sorry to hear you're having these issues.

    There's a couple troubleshooting steps I'd like you to try to see if we can narrow down the cause of this problem.

    First, could you please run a plugin conflict test as outlined in the following article? This will eliminate the possibility of a conflict with another plugin. https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    If that does not lead to a solution, could you please enable WP_DEBUG and provide us with the output of your debug.log file?

    To enable WP_DEBUG, change the following line in your wp-config.php file:

    define('WP_DEBUG', false);

    To this:

    // Enable WP_DEBUG mode
    define( 'WP_DEBUG', true );
    
    // Enable Debug logging to the /wp-content/debug.log file
    define( 'WP_DEBUG_LOG', true );
    
    // Disable display of errors and warnings
    define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );

    After you've attempted to download a certificate, please go to wp-content/ on your server via FTP and download the debug.log file to your local computer. Then, open that file with a text editor like notepad (Windows), GEdit (Linux), or TextEdit (Mac). You can then save the file as a .txt file and upload it here as an attachment to your post.

    I look forward to seeing the results of your tests.

    Best regards,

    James Morris

    Nathan

    It's not generating an error at all. That's what's crazy. I did some digging and found that on the coursepress/2.0/include/coursepress/helper/class-utilitiy.php on Line 1206

    $body = wp_remote_retrieve_body( wp_remote_get( $requested_file ), $force_download_parameters );

    $body is blank so it's causing this code to display the error "Something went wrong".
    if ( empty( $body ) ) {

    header( 'Pragma: public' );

    header( 'Expires: 0' );

    header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );

    header( 'Cache-Control: private', false );

    header( 'Content-Type: ' . $requested_file_obj['type'] );

    header( 'Content-Disposition: attachment; filename="' . $filename . '"' );

    header( 'Content-Transfer-Encoding: binary' );

    header( 'Connection: close' );

    echo $body;

    } else {

    _e( 'Something went wrong.', 'cp' );

    }

    exit();

    To temporary fix the problem, I just added this before that code:
    header('Location: ' .$requested_file);
    Granted the url is displayed and the path isn't hidden, but right now we need it to work. Any idea what would cause the wp_remote_retrieve_body( wp_remote_get ()); to not return anything?

    James Morris

    Hello Nathan,

    We'd like to take a bit closer look at this issue as this is a bit unusual. Would you please grant us Support Staff Login to your site?

    You can learn how to grant WPMU DEV Support Access at the following link:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Please reply back here once you've enabled access so I will be notified.

    Best regards,

    James Morris

    James Morris

    Hello Nathan,

    You can send the details through our secure form. This will go directly to me.

    Please visit the Contact page and complete the form with the following information:

    Subject: "Attn: James Morris"

    In the Message box, please provide the following:

    - link back to this thread for reference
    - any other relevant urls

    - Admin login:
    Admin username
    Admin password
    Login url

    - Domain Registrar Login
    Admin username
    Admin password
    Login url

    - Hosting Control Panel Login
    Admin username
    Admin password
    Login url

    - FTP credentials
    host
    username
    password
    (and port if required)

    Best regards,

    James Morris