Coursepress Pro uploaded files broken links

Files uploaded inside of CoursePress can not be retrieved and downloaded by Instructors. The links to the files download corrupt files with no content.

I've verified that the documents are being uploaded to the local web server and reside in the proper folder structure - and are fully in-tact:
site > wp-contnet > uploads > sites > 3 > 2016 > 03 > the_document

A working example of an upladed file on my server is: http://university.YogaKids.com/wp-content/uploads/sites/3/2016/03/adult-yoga-class.pdf
(unfortunately for some reason, all the uploaded files return 404 errors, despite my verifying their existence through my FTP client looking into the folder structure)

The URL in the Coursepress Pro Student workbook that links to this file is:
http://university.yogakids.com/?fdcpf=Q8MwKw9CGqgS5CWeK4dhAlYROIX9vcW9Kj4etFaJGA3XP5DYRbyGTEXuibsHLMlfZhSGw_h4E-c5CxagLTOPpdfmF55BzuGYSsQqYtSHD90_y1bxRT3LeAZJIC17K9r3

I"m trying to find a workaround or a direct-access URL to modify the Coursepress plugin so that instructors can easily download student files for grading.

  • Michael Bissett

    Hey pookiemcnoodles,

    Right now, what's got my attention is the fact you've got Amazon S3 integrated via the WP Offload S3 plugin. I've been able to get the original file URL going by uploading the file to S3, but there's still the problem of that encrypted URL. :disappointed:

    For the moment, let's give this a go:

    Inside of this file:

    /coursepress/includes/unit-modules/file_input.php

    Change lines 30-42 from this:

    $response->guid = $encryption->encode( $response->guid );
    ?>
    <div class="module_file_response_answer">
    	<?php if ( $show_label ) { ?>
    		<label><?php _e( 'Uploaded File', 'cp' ); ?></label>
    	<?php } ?>
    	<div class="front_response_content">
    		<a href="<?php echo trailingslashit( home_url() ) . '?fdcpf=' . $response->guid; ?>"><?php
    			_e( 'Download file ', 'cp' );
    			echo ' ( ' . $file_extension . ' )';
    			?></a>
    	</div>
    </div>

    To this:

    $response->guid = $response->guid;
    ?>
    <div class="module_file_response_answer">
    	<?php if ( $show_label ) { ?>
    		<label><?php _e( 'Uploaded File', 'cp' ); ?></label>
    	<?php } ?>
    	<div class="front_response_content">
    		<a href="<?php echo $response->guid; ?>"><?php
    			_e( 'Download file ', 'cp' );
    			echo ' ( ' . $file_extension . ' )';
    			?></a>
    	</div>
    </div>

    You should be able to access the original URLs then. If there's still a problem, could you please send in the following via our secure contact form:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include FTP log-in details (hostname, username & password)
    - Include any relevant URLs for your site

    IMPORTANT: Please make sure you select "I have a different question" for your topic, so it doesn't go back to the forums - this and the subject line ensure that it gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks! :slight_smile:

    Kind Regards,
    Michael

    Edit: Before I do flag for SLS, I do have a question about this. Was there a time when this wasn't an issue on the site? What changed around the time that this problem started to occur?

    That'd be great info to have handy. :slight_smile: