Help Needed – Displaying Instructor Name in Course Cards Without Modifying Core

Help Needed – Displaying Instructor Name in Course Cards Without Modifying Core

από Soumya Manna -
Αριθμός απαντήσεων: 1

Hi Devs,

I'm new to Moodle development, and I need to display the instructor's name in the course cards (like those shown on the dashboard or course listing pages).

I noticed that a core function is responsible for passing variables to course-related templates. When I manually pass variables like:

'activitycount' => $activitycount,
'activitycomplete' => $activitycomplete,
directly in the core code, it works, and I can access those values in the template. However, I want to avoid modifying core files.

image%20%281%29.png

image%20%282%29.png

I've tried building multiple plugins to inject this data but haven’t been successful.

Could you please suggest the best way to pass additional data (like the instructor's name) to the course card templates without touching core code?

Any guidance or examples would be greatly appreciated!

Thanks in advance!

Μέσος όρος βαθμολογίας: -
Σε απάντηση σε Soumya Manna

Help Needed – Displaying Instructor Name in Course Cards Without Modifying Core

από Mark Johnson -
Φωτογραφία Core developers Φωτογραφία Particularly helpful Moodlers Φωτογραφία Peer reviewers Φωτογραφία Plugin developers

One option would be to write an override_webservice_execution callback, to modify the response to the core_course_get_enrolled_courses_by_timeline_classification web service function, which is used to fetch the data for those cards.