Hi, I'm using moodle 3.8, I created a new course and added two custom fields (coursecode and sencecode) and these two I need to get in my custom block. In that block I got the user id by doing $USER->id and the course id by doing $COURSE->id, but I can't seem to find how to extract the values from the custom fields I added.
Hi,
Off the top of my head, I think $COURSE->customfields, and if not look at an example in /course/tests/customfield_test.php.
Unfortunately, $COURSE->customfields doesn't exist. Wouldn't it be amazing if it did?
I added some sample code to the documentation to help with exactly this task: https://docs.moodle.org/dev/Custom_fields_API#Example_code_for_course_custom_fields
I added some sample code to the documentation to help with exactly this task: https://docs.moodle.org/dev/Custom_fields_API#Example_code_for_course_custom_fields