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

Auto-create Groups Notice

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7
    • Fix Version/s: None
    • Component/s: Groups
    • Labels:
      None
    • Affected Branches:
      MOODLE_37_STABLE

      Description

      When a group gets created automatically the form might include or not the field 'enablemessaging' depending on the ability of the user to create group conversations:

      File: group/autogroup_form.php

      // Enable group messaging for the groups to be auto-created.
      if (\core_message\api::can_create_group_conversation($USER->id, $coursecontext)) {
          $mform->addElement('selectyesno', 'enablemessaging', get_string('enablemessaging', 'group'));
          $mform->addHelpButton('enablemessaging', 'enablemessaging', 'group');
      }
      

       

       If the field does not get included in the form, upon processing we get a Notice, since the property $data->enablemessaging does not exist:

      File: group/autogroup.php 

      $newgroup->enablemessaging = $data->enablemessaging;
      

       

      The first solution I found was to include in the config.php:

      $CFG->messaging = 1;
      

       

      Now, I tested and consider that a better Canonical solution is:

      • Modify the file group/autogroup.php  replacing the line mentioned before by:

      $newgroup->enablemessaging = $data->enablemessaging ?? 0;
      

      In this fashion we do not have to alter the config.php!

       

      Any comments or suggestions?

       

       

      Related issue: MDL-63620 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                felicecandilio Felice Candilio
                Participants:
                Component watchers:
                Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: