Upload Assignment files to S3

Home Forums WPLMS AddOns WPLMS S3 Upload Assignment files to S3

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #273374
    diwakarc
    Spectator
    Hi There, We are using WPLMS Assignment and S3 plugins and we want whenever Students submit their assignments it should be uploaded directly to our S3 bucket which we have already associated with the site using the S3 plugin. Do let me know if it is possible or not with some integration or addon or if it could be handled with some customization.   Thanks
    #273535
    diwakarc
    Spectator
    Hi There, A quick response to this issue would be much appreciated. Thanks
    #273570
    Anshuman Sahu
    Keymaster
    Hi Im sorry there is no quick tip available for this right now .  
    #273574
    diwakarc
    Spectator
    Can you at least Guide us on if its achievable with customization like are there feasible hooks available in both the plugins to achieve this?   Thanks
    #273771
    Anshuman Sahu
    Keymaster
    Well its simple the uploaded attachment is saved in comment meta : attachmentId you can customize the upload form and simply set the meta of the comment when assignment comment is posted .
    #273892
    diwakarc
    Spectator
    Hi Alex, Thanks for the suggestion, I'll have a look at the code level and get back to you if I have further queries.
    #274473
    diwakarc
    Spectator
    Hi Alex, Could you please share the hooks which I'll have to extend in order to replace the assignments URL with the one on S3.
    #274808
    Anshuman Sahu
    Keymaster
    Well you can check these functions on these hooks .BAsically what we did is to show the upload form above the comment form and than handle it when the comment is posted in the assignment : add_filter('preprocess_comment',        array($this, 'checkAttachment')); add_action('comment_form_top',          array($this, 'displayBeforeForm')); add_action('comment_form_before_fields',array($this, 'displayFormAttBefore')); add_action('comment_form_logged_in_after',array($this, 'displayFormAtt')); add_filter('comment_text',              array($this, 'displayAttachment')); add_action('comment_post',              array($this, 'saveAttachment')); add_filter('upload_mimes',              array($this, 'getAllowedUploadMimes')); add_action('delete_comment',            array($this, 'deleteAttachment')); add_filter('comment_notification_text', array($this, 'notificationText'), 10, 2);   you can find it in " assignments.php " in wp-content/plguins/wplms-assignments/includes folder
    #274900
    diwakarc
    Spectator
    Hi Alex, I actually figured this out, but now the URL that I'm getting from S3 is not accessible for downloading. If I use it in WPLMS S3 shortcode then it works but not if I directly use the URL. Can you help me with this? Thanks
    #275253
    Anshuman Sahu
    Keymaster
    Well you can simply use this shortcode to enter in the comment meta instead of the id for the user attachment : [wplms_s3 file="" ....] [/wplms_s3] and then echo do_shortcode the same when you have to show this .
    #275865
    diwakarc
    Spectator
    Hi Alex, I didn't use the shortcode as you suggested as it was displaying the entire File and I wanted to display just the downloadable URL of the assignment. I instead used the get_s3_url function to fetch the URL. Using this function I was able to get the URL, but it expires after the provided duration, for now, I have provided a longer duration, but if you could suggest a way to fetch a non-expiring URL that would be great.   Thanks
    #276307
    Anshuman Sahu
    Keymaster
    Well that is actually the essence of the plugin . this why you use the url . you can set more time to the url : get_s3_url function . the second parameter get_s3_url($file,86400) for 1 day duration of the file .
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Upload Assignment files to S3’ is closed to new replies.