-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback - Editors can't view modules and add lessons to modules when editing a course #2331
Comments
Hey @cynthianorman |
Thank you for your help @westnz https://drive.google.com/file/d/1qM4GrxB9foRiOVTrLSKtH5eZqFs7VksN/view?usp=sharing I will need access in order to add lessons to modules |
Thanks for looking into this issue, folks 🙌 @cynthianorman Until we can identify what's going on, I've made you an Administrator on https://learn.wordpress.org/. You should be able to proceed with content creation for now 😃 |
Thank you for your assistance @bsanevans |
Looking at the output of the course in the code editor, it appears modules have teacherIds assigned to them
I'm going to post this question to the Sensei development team and see if we can get their insights. |
Hi folks! Here is a snippet that could be used as a workaround for this. add_action( 'plugins_loaded', function() {
if ( current_user_can( 'editor' ) ) {
remove_filter( 'get_terms', [ Sensei()->modules, 'filter_module_terms' ], 20, 3 );
remove_filter( 'get_object_terms', [ Sensei()->modules, 'filter_course_selected_terms' ], 20, 3 );
}
} ); Basically, it will remove this module restriction for editors, similar to what is done for administrators. 😉 |
Thanks @renatho, we'll see if we can implement this workaround in the coming weeks. |
@unprintedch I have created #2364 to implement @renatho's suggested fix. Do you think you would be able to test this out for us and see if this resolves the issue? |
I'll take some time on that monday. |
So with this the PR on my local environement the previous tests still give the same results BUT! |
@renatho can you think of any possible negative outcomes to hooking your solution into admin_init vs plugins_loaded? |
The filters are added when the Sensei plugin runs, independent of any hook. So, ideally, it would be as soon as possible to make sure it would remove the filters for any situation. But if it's not working for some reason, and in your tests the issue was fixed, I think that's fine since it's a "controlled environment". If we see another issue related to this, we know that it could be related to this. And if it's fine, I'd suggest another tweak to catch more cases. We could do it with the
|
Thanks @renatho @unprintedch would you like to go ahead and test Renatho's alternative solution? |
On my local install, with that drop at the bottom of the functions.php
A teacher can see modules he create in every cases. |
Excellent, thanks @unprintedch. I've updated #2364, and I will do my best to test it myself this week, in order to get it merged. |
Type of feedback
//dev
Description
Editors can't seem to add lessons to modules and view modules in the backend when editing courses in Sensei.
Step-by-step reproduction instructions (optional)
Other information (optional)
Editors should be able to edit courses, modules and lessons to perform their role as content creators.
The text was updated successfully, but these errors were encountered: