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

two notices diplayed adding a new instance of a non core module

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Other
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Download http://download.moodle.org/plugins/mod/NEWMODULE.zip.
      Change NEWMODULE to WIZARD and newmodule to wizard.
      Install and go to add a new instance of wizard.
      you will get two notices
      undefined variable introeditor in course/modedit.php at line 430 and 432.

      Fix (found by David):
      change line 401 of moodle20/course/modedit.php
      from
      if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, false)) {
      to
      if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, true)) {

      Thanks David.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            mudrd8mz David Mudrák added a comment -

            The reason for theis error is following: at the line 401, the condition

            if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, false)) {

            is used to check whether $introeditor shall be intialized. Note the default 'false' here.

            Later at the line 429, the condition

            if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, true)) {

            is used to check whether $introeditor shall be processed.

            Because the fresh new module does not explicitly declare the features, the default values are used and that produces this mess. Elsewhere in Moodle code, we expect the default true for this feature (so the editor is rendered in the form, for example). So I am going to expect here, too.

            Show
            mudrd8mz David Mudrák added a comment - The reason for theis error is following: at the line 401, the condition if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, false)) { is used to check whether $introeditor shall be intialized. Note the default 'false' here. Later at the line 429, the condition if (plugin_supports('mod', $fromform->modulename, FEATURE_MOD_INTRO, true)) { is used to check whether $introeditor shall be processed. Because the fresh new module does not explicitly declare the features, the default values are used and that produces this mess. Elsewhere in Moodle code, we expect the default true for this feature (so the editor is rendered in the form, for example). So I am going to expect here, too.
            Hide
            skodak Petr Skoda added a comment -

            +1, thanks!

            Show
            skodak Petr Skoda added a comment - +1, thanks!
            Hide
            mudrd8mz David Mudrák added a comment -

            Fixed in CVS HEAD. Thanks Daniele for spotting this and thanks Petr for the review.

            Show
            mudrd8mz David Mudrák added a comment - Fixed in CVS HEAD. Thanks Daniele for spotting this and thanks Petr for the review.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: