by Jitendra Gaur.
Hi,
To insert/create chat activity directly from database you need to insert into following tables -
course_id = (course id where you want to create a chat activity )
chat_id = (inserted id of chat table)
module_id (inserted id of course_modules table)
INSERT INTO `mdl_chat` SET course = course_id, name = 'test1', intro = 'intro test1'
INSERT INTO `mdl_course_modules` SET course = course_id, module = (SELECT id FROM `mdl_modules` WHERE name = 'chat') ,instance = chat_id , visible = 1, showavailability = 1
INSERT INTO `mdl_course_sections` SET course = course_id, section = 1, sequence = module_id
and reset the section cache in course table
UPDATE `mdl_course` SET `sectioncache` = NULL WHERE id=course_id;
Thanks & Regards,
Jitendra Gaur