Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64476

About event \core\event\course_module_updated and save_form_elements

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.6
    • Fix Version/s: None
    • Component/s: Plagiarism
    • Labels:
      None
    • Affected Branches:
      MOODLE_36_STABLE

      Description

      I am working on a plugin implementation, and I need to perform certain action after the assignment module setting is updated. The program logic is

      • after the user clicks the save button in the assignment edit page, the event course_module_updated event is triggered
      • in the event handler, the procedure will retrieve the updated setting configuration from the plugin created database and then do some action

      But after some testing, the setting retrieved in the 2nd step seems to be still the old settings, i.e. not the latest settings input from the user. And I found that the save_form_elements function, which suppose to save the settings, is called after the event_handler finished. As a result, the 2nd step will just work on the old setting which is not correct. As a workaround, I need to enter the assignment configuration page and click the save button again, such that the event handler can work on the "latest" setting saved from the "save_form_elements" function. 

       

      So I would like to ask if it is the correct behaviour or it is a bug, and any recommendation to implement the logic better, e.g. in the event_handler, I can also retrieve the latest config data instead of loading from the database.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tplau Patrick Lau
                Participants:
                Component watchers:
                Dan Marsden, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: