sensei
sensei copied to clipboard
VideoPress uploads as teacher fail
See https://github.com/Automattic/sensei/issues/2128#issuecomment-1283109987 for latest update.
Steps to Reproduce
- Activate and connect Jetpack with a Professional plan; activate the video storage feature.
- Log in as a teacher.
- Try to upload a video while editing a lesson.
- Video won't upload correctly and the user will immediately lose access if they view the media library.
What I Expected
Ability to insert videos uploaded via VideoPress into courses/lessons as a teacher.
What Happened Instead
Immediately lose access.
WordPress / Sensei version
Sensei 1.10.1 WP 4.9.5
Browser / OS version
Chrome
=======
VideoPress uploads videos and sets the attachment author to ID of 0. We are currently filtering all attachments to just those created by the teacher. One possible fix is in https://github.com/Automattic/sensei/commit/0d9139394e50f0fc4a0774c6ea7f10b5eacc39fc, however there still seems to be some choppiness (need to refresh before inserting uploaded media).
May not need to do anything here as it could be fixed by VideoPress. For reference - pxWta-N4-p2.
Hi, Is there any change in this issue?
Meanwhile, I tested it further:
A user with "Author" or "Contributor" role can see all uploaded videos, no matter who uploaded it. This is also a mistake. It would be better if all users would only see the video which they uploaded own.
"Teacher" role (with Sensei plugin) works well, because teachers can only see their own media (music, pdf, image) except the video. Unfortunately, they still can not see it.
I am waiting for your reply!
BR, Roland
I tested this out today and found out that:
- The uploads now do work for VideoPress
- There is still a permission problem where the teacher can't view the uploaded VideoPress videos
I think it has to do with restrict_media_library_modal here
https://github.com/Automattic/sensei/blob/132dda1146fa7ba7e5508886ccda5e97b7c368e0/includes/class-sensei-teacher.php#L1451
When a VideoPress video is uploaded, the author get's set to the Jetpack site owner ID, not the teacher id.
Maybe a good workaround would be:
- Hook into the videopress upload
- If it's a
post_mime_typeofvideo/videopress, add postmeta to set the teacher ID - Add a check to
restrict_media_library_modalto check for that postmeta