Home › Forums › WPLMS AddOns › WPLMS S3 › Upload Assignment files to S3
Tagged: assignment, wplms s3
- This topic has 11 replies, 2 voices, and was last updated 4 years, 4 months ago by Anshuman Sahu.
Viewing 12 posts - 1 through 12 (of 12 total)
-
AuthorPosts
-
July 7, 2020 at 3:41 pm #273374diwakarcSpectatorHi 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. ThanksJuly 8, 2020 at 11:50 am #273535diwakarcSpectatorHi There, A quick response to this issue would be much appreciated. ThanksJuly 8, 2020 at 1:57 pm #273570Anshuman SahuKeymasterHi Im sorry there is no quick tip available for this right now .July 8, 2020 at 2:12 pm #273574diwakarcSpectatorCan you at least Guide us on if its achievable with customization like are there feasible hooks available in both the plugins to achieve this? ThanksJuly 9, 2020 at 3:00 pm #273771Anshuman SahuKeymasterWell 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 .July 10, 2020 at 8:27 am #273892diwakarcSpectatorHi Alex, Thanks for the suggestion, I'll have a look at the code level and get back to you if I have further queries.July 14, 2020 at 6:46 am #274473diwakarcSpectatorHi 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.July 15, 2020 at 2:55 pm #274808Anshuman SahuKeymasterWell 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 folderJuly 16, 2020 at 6:42 am #274900diwakarcSpectatorHi 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? ThanksJuly 17, 2020 at 2:31 pm #275253Anshuman SahuKeymasterWell 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 .July 20, 2020 at 12:00 pm #275865diwakarcSpectatorHi 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. ThanksJuly 21, 2020 at 3:56 pm #276307Anshuman SahuKeymasterWell 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 .
-
AuthorPosts
Viewing 12 posts - 1 through 12 (of 12 total)
- The topic ‘Upload Assignment files to S3’ is closed to new replies.