After creating a new course in moodle 2.2 next I tried to add a forum using oktech library edit_forums with type 'add'. This seems to work and the record is in the database, but when I see the course homepage there is no new forum there.
Then i tried to add discussion to that forum but i get exception:
Anyone know why discussion creation failed?
I follow the chain and ended up in moodle-root/lib/datalib.php in function get_coursemodule_from_instance($modulename, $instance, $courseid=0, $sectionnum=false, $strictness=IGNORE_MISSING). I dont want to go any deeper into the core.
Another case is after creating a course, I click on the course link so that now im in the course's homepage where there is a default News Forum. In the mdl_forum table a new record was added and I use the 'id' of the new record to create new discussion(like above). And it worked.
Is there's something I missed between these two approaches?