Get "id" from mdl_course_modules directly after module creation

Get "id" from mdl_course_modules directly after module creation

by Paul K -
Number of replies: 1

Hi,


I'm currently developing an activity plugin in which I need to create a folder and file structure based on id's from the mdl_course_modules table. Is it possible to read the id of the newly added module instance from the mdl_course_modules table before inserting new record into the plugin table in the database?

I need to get exactly this value during the creation of you module instance:

https://................/mod/testplugin/view.php?id=68900


I will appreciate for any suggestions.

Warm regards

Paul

Average of ratings: -
In reply to Paul K

Re: Get "id" from mdl_course_modules directly after module creation

by Paul K -

Actually I did not know that the property coursemodule was ready to use at that point. It works like a charm.


module_id = $plugin_name->coursemodule;