Creating a Page Activity/Resource directly in Database

Re: Creating a Page Activity/Resource directly in Database

by Andrew Normore -
Number of replies: 0

GOT IT!

I was missing Inserting values from mdl_course_modules into mdl_course_sections  as a sequence!

Once this was done, I was able to call rebuild_course_cache($courseid,true); to rebuild the course. This now correctly grabs the new module in sequence!

I dug through the code to this function get_array_of_activities() in /course/lib.php

I see here it grabbed a "RAW" list of modules, and my inserted data was present. Great, but why not working?

Because the build loop is using foreach ($sequence as $seq) {

So, if you didn't add your custom module to a sequence, it simply gets missed! Moodle is looking for that sequence number.

Fantastic. Thanks every one for help on this issue. It would be easy to take this information and create an API that pushes remote content in to moodle page activities. ROCK ON!