gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
174 stars 134 forks source link

Unable to set instructor for lesson #735

Open AndreaBarghigiani opened 5 years ago

AndreaBarghigiani commented 5 years ago

1. Reproduction Steps

Try to change the author/instructor of a lesson with the new editor (Gutenberg). If the WordPress installation has only one administrator and all instructors it does not show the Author dropdown. I know that it was a REST API problem and even if it seems solved it does not work as expected.

I saw that you added edit_posts to the instructor role but this do not solve the problem, maybe is for this that you created the LifterLMS sidebar inside the editor.

2. Expected Behavior

I would like to be able to change/add instructor for lessons, the LifterLMS sidebar in the course screen will be perfect!

3. Actual Behavior

I do not have any author dropdown, the only way to have it with tha instructors is to give them also the author role because it looks like WordPress 5.0.3 does not have solve this issue yet.

4. Error Messages / Logs

No error messages only a missing feature.

thomasplevy commented 5 years ago

@AndreaBarghigiani could you post your system report please

AndreaBarghigiani commented 5 years ago

Sorry didn't think it was necessary. I am working on a dev environment 😉

Wordpress

Home Url: http://0.0.0.0:8080 Site Url: http://0.0.0.0:8080 Login Url: http://0.0.0.0:8080/wp-login.php Version: 5.0.3 Debug Mode: Yes Debug Log: Yes Debug Display: No Locale: it_IT Multisite: No Page For Posts: Not Set Page On Front: Home (#6) [http://0.0.0.0:8080/] Permalink Structure: /%postname%/ Show On Front: page Wp Cron: Yes

Settings

Version: 3.26.2 Db Version: 3.26.2 Course Catalog: Catalogo Corsi (#34) [http://0.0.0.0:8080/corsi/] Membership Catalog: Catalogo Membership (#35) [http://0.0.0.0:8080/memberships/] Student Dashboard: Bacheca (#37) [http://0.0.0.0:8080/dashboard/] Checkout Page: Acquisti (#36) [http://0.0.0.0:8080/purchase/] Course Catalog Per Page: 9 Course Catalog Sorting: menu_order,ASC Membership Catalog Per Page: 9 Membership Catalog Sorting: menu_order Site Membership: Not Set Courses Endpoint: my-courses Edit Endpoint: edit-account Lost Password Endpoint: lost-password Vouchers Endpoint: redeem-voucher Autogenerate Username: yes Password Strength Meter: yes Minimum Password Strength: strong Terms Required: no Terms Page: Not Set Checkout Names: required Checkout Address: required Checkout Phone: optional Checkout Email Confirmation: yes Open Registration: no Registration Names: required Registration Address: optional Registration Phone: hidden Registration Voucher: optional Registration Email Confirmation: no Account Names: required Account Address: required Account Phone: optional Account Email Confirmation: yes Confirmation Endpoint: confirm-payment Force Ssl Checkout: no Country: IT Currency: EUR Currency Position: left Thousand Separator: , Decimal Separator: . Decimals: 2 Trim Zero Decimals: no Recurring Payments: no Email From Address: andrea@cupofcraft.it Email From Name: Copy42 Email Footer Text: Email Header Image: Cert Bg Width: 800 Cert Bg Height: 616 Cert Legacy Compat: no

Gateways

Manuale: Disabled Manuale Logging: Manuale Order: 1

Server

Mysql Version: 5.5.5 Php Curl: Yes Php Default Timezone: UTC Php Fsockopen: Yes Php Max Input Vars: 1000 Php Max Upload Size: 2 MB Php Memory Limit: 256M Php Post Max Size: 8M Php Soap: No Php Suhosin: No Php Time Limt: 30 Php Version: 7.2.13 Software: Apache/2.4.25 (Debian) Wp Memory Limit: 40M

Browser

HTTP USER AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0

Theme

Name: Copy42 Version: 2.7.1 Themeuri: https://demo.SkillsAndMore.com/ Authoruri: https://skillsandmore.org/ Template: genesis Child Theme: Yes Llms Support: No

Plugins

Atomic Blocks - Gutenberg Blocks Collection: 1.4.22 Copy42 Plugin: 0.0.1 Genesis Connect for WooCommerce: 1.0 Genesis Simple FAQ: 0.9.1 LifterLMS: 3.26.2 LifterLMS WooCommerce: 2.0.0-beta.5 Simply Show Hooks: 1.2.1 WooCommerce: 3.5.3 WooCommerce Blocks: 1.2.0 WooCommerce PayPal Checkout Gateway: 1.6.6 WooCommerce Services: 1.18.0 WP User Avatar: 2.1.6

Integrations

BbPress: No BuddyPress: No WooCommerce: Yes

Template Overrides

course/lesson-preview.php (ver: 3.19.2): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.19.2) course/syllabus.php (ver: 3.24.0): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.0.0 - refactored for sanity's sake) loop/author.php (ver: 3.0.0): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.0.0) loop/content.php (ver: 3.14.0): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.14.0) product/access-plan-feature.php (ver: 3.23.0): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.23.0) product/access-plan-pricing.php (ver: 3.23.0): /var/www/html/wp-content/themes/copt42-theme/lifterlms/ (ver: 3.23.0)

thomasplevy commented 5 years ago

Okay so it looks like this isn't a new issue introduced in 5.0 via the block editor.

We've never added any code in order to get Instructors (or Instructor's Assistants) so display in the WP core author's list when creating / editing courses & lessons.

We don't worry about the actual post_author when determining permissions to access content. So an instructor (or asst.) can access lessons based on the existence of their name in the Instructors list on the parent course.

So for LifterLMS's purposes the author of the lesson doesn't matter. It's never displayed anywhere on the frontend and the permissions are managed via the parent course.

I could imagine that having the author set as the instructor could matter but I'm not entirely sure why it matters. I want to know why it matters so I can help judge the severity of the issue. I'm sure I can find a way to fix it but the severity mattes to me!

I can see this being an issue if you're attempting to change the instructor. The admin creates a course with a bunch of lessons and then "moves" it to the instructor. The admin can add the instructor as the primary (or only) instructor in the course but there would be no way to then modify the "author" of the related courses. This could I suppose create a confusing experience on the admin panel but it wouldn't actually cause any functional issues to how everything works.

I'd like to know the "Why" of this issue!

Thanks,

AndreaBarghigiani commented 5 years ago

Hi @thomasplevy, in fact this is not a new issue and is not even related to LifterLMS itself (because is the new editor that makes the wrong API call) but it's something that impact it's functionality.

At the same time my problem is not with the ability of the instructor (or ass.) to read/edit a lesson's content but, in the project that I am working on, there is the need to show the instructor of each lesson.

I completely agree with the way you managed permissions, the WordPress user that creates the course could be (and in this case is) different from the instructor that runs the course.

I opened this as a bug mostly because I saw the LifterLMS sidebar in the course creation that let me add specific instructors for the course and I thought that it was just a lapse the missing of it in the lesson creation page.

I understand that you can say that this is not an important feature for LifterLMS and you don't have the time to work on it. If I will have to add this feature in the project I'm working on I will send you the code via PR 😉

Thank you for your time.

thomasplevy commented 5 years ago

@AndreaBarghigiani I do think it make's sense to ensure the Instructor is exposed as a potential author to be selected here so I'm going to leave this as an open issue for the meantime. If you get it resolved please do send over a PR

007ke commented 3 years ago

@thomasplevy
The feature discussed by @AndreaBarghigiani is great and we see a potential. Would love to see that being added.

@AndreaBarghigiani ... hi Andrea, did you manage to figure a way out or created any code?

Thanks > Ketan

AndreaBarghigiani commented 3 years ago

Hi @007ke, I solved this case by adding a custom meta field in the lesson post types. I did it using CMB2 and the Ajax Search extension. This is the settings for the field that I created:

$cmb_les->add_field(
    array(
        'name' => 'Docente lezione',
        'id' => $les_prefix . 'search_instructor_0',
        'type' => 'user_ajax_search',
        'multiple' => true,
        'sortable' => true,
        'query_args' => array(
            'role' => array( 'Instructor' ),
            'search_columns' => array( 'user_nicename' ),
        ),
    )
);

You can customize as much as you want 😉

007ke commented 3 years ago

Thanks @AndreaBarghigiani Did this help you with selecting any other 'instructor' or 'instructor's assistant' from within a particular lesson and have a particular lesson (content / assignment / quiz) owned by them and can grade 'pass' or 'fail' for that student. While the main course 'instructor' can be someone else?

thomasplevy commented 3 years ago

@007ke the actual "owner" of a lesson shouldn't have any impact on whether or not the instructor can grade something. If you're instructors are unable to grade could you open a new issue about this so we can have a closer look? I think you might be associating this issue with your issue but based on what I'm reading here these are not related!

007ke commented 3 years ago

@thomasplevy My apology... i was only trying to understand the fantastic feature proposed by Andrea ... i.e. to have another person (instructor or assistant instructor) do the grading for say an assignment (lesson) within the course. Example Scenario .... there is a course Maths with 20 lessons on different Maths topics (sections). Every section can have a different skilled and specialised instructor that is a master in that topic. So all the lessons within that particular lifterLMS section (content, quizzes and assignments) can be only managed and graded by this person for all the students within the course Maths. No other instructor can view or modify including grading and other sensitive areas to mess up anything.

In this the Course owner 'Author' can have the master role while lesson owners 'instructor' or 'asst' will have lesson specific roles. If no instructor is selected within the 'lesson', then the default owner is the same as the course owner ...which is the 'author'.

This will help create granular controls within the existing roles and no new roles are required

It would be great if we can also have grading 'status' defined in the assignment and quizzes so that an 'assistant' role can grade but the status changes to 'awaiting approval' from 'instructor' role while the instructor can have the status 'approved'. This way multiple 'assts' can be added to manage and help the instructor BUT the final approval is always done by the 'instructor'.

thomasplevy commented 3 years ago

@007ke this is interesting but doesn't exactly get automatically added as a feature based on the information provided in this initial feature request in this issue here.

In order to better help us track feature requests could you please open your feature request as a new issue or submit it via our feature request intake form at https://lifterlms.com/feature-request

I do not mean to silence your request but it feels to me like you're assuming that adding the initially requested feature will automatically add all sorts of functionality that would not be added by adding this feature!

Furthermore, adding additional "features" into a single issue makes the item get a lot harder to implement (they become "epics" as opposed to digestible features.

Thank you for understanding and cooperating with me on this!

thomasplevy commented 3 years ago

@007ke we'll discuss this over slack!