Open thomasplevy opened 6 years ago
I am working on something similar right now for a client. Basically all I need is to create a page that lists all the instructors and offer filter option (example) to see which instructor teaches in a specific course.
Right now I've reached this point but when I use the get_courses()
method of the LLMS_Instructor class I get an empty array, do you have any suggestion?
@AndreaBarghigiani if I change like 31 to var_dump( $docente_corsi->get_courses() );
I get a list of courses.
A few things to check:
1) Are your instructors all actually using the instructor
role or are they actually administrators
?
2) Do your instructors have courses assigned to them?
Hi @thomasplevy, my bad.
The problem was that the only user that had courses it was the administrator, now that I have modified few courses I get something. Anyway as you can see from my code I need to access to the course ID but it looks like it is protected, do you have any other suggestions?
Beside I saw that you added some labels, how can I help you out with this issue? I know that my solution is the opposite of this specific issue (I filter instructors based on courses) but I would love to help you adding this feature.
Thank you, Andrea
Ok I can get the id of the courses via:
$i_courses = $docente_corsi->get_courses();
foreach ( $i_courses as $i_course ){
$i_course->id;
}
Anyway as you can see from my code I need to access to the course ID but it looks like it is protected, do you have any other suggestions?
LLMS_Instructor->get_courses()
responds with an array of LLMS_Course
objects. The best way to access the ID would be to use the built-in getter: $course->get( 'id' )
. See the other available properties which can be "got" here: https://github.com/gocodebox/lifterlms/blob/master/includes/models/model.llms.course.php
Beside I saw that you added some labels, how can I help you out with this issue? I know that my solution is the opposite of this specific issue (I filter instructors based on courses) but I would love to help you adding this feature.
Oh I don't know. We don't have any specific plans for building this (that's why it's in future). I've had some requests for it and I added the labels since we've been trying to clean up and add more descriptive labels.
I think there's two versions of this 1) Author/Instructor profile pages which automatically list all the instructor's courses 2) Filters on the existing catalog (course/membership archives) that allow filtering by instructor. I think there's a bunch of other filters that should be added there as well (taxonomies, etc...)
We will not be adding new shortcodes to LifterLMS (subject to change). We're moving to fully support the block editor. If you wanted to build this as a block we're currently adding blocks and block-editor related code into the core via the LifterLMS Blocks plugin: https://github.com/gocodebox/lifterlms-blocks
Alright I've used the get()
method as you suggested.
For the LifterLMS Blocks I will surely work on it because there are some things that I want to help you out because I think that you have done a really great job but for some blocks we can add some features.
Looking to work on it in the following months 👍
me too thanks!
Filter catalogs by instructors