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

Auto-create Groups Notice

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.7, 3.11
    • 3.9.7, 3.10.4
    • Groups
    • MOODLE_311_STABLE, MOODLE_37_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • MDL-66673-MOODLE_39_STABLE
    • MDL-66673-MOODLE_311_STABLE
    • MDL-66673-master
    • Hide

      Setup

      1. Log in as admin and go make 3 S test courses
      2. Go to Site Administration > Users > Permissions > Define roles and click Add new role
      3. On the Adding new role form Use role of archetype Teacher and click Continue
      4. Edit short name to editingteacher-nocap and custom full name Teacher NoCap
      5. Press Crtl+F and search for moodle/course:creategroupconversations and do not Allow this capability then click Create this role.
      6. Create two new users whom we can test with

      Testing Teacher NoCap

      1. Go the first created test course
      2. Enrol one of the created users with the role as Teacher NoCap
      3. Login as this users and visit the course again
      4. Under the Cog Wheel click More...
      5. Visit Users > Groups and click Auto-create groups button.
      6. Fill the form with any name Group @ and any member count and submit.
      7. Make sure you don't see the error above.
      8. Log in as admin
      9. Go to the course where you just created the groups
      10. Under the Cog Wheel click More...
      11. Visit Users > Groups and select one of the created groups and Edit group settings
      12. Confirm that Group messaging is set to no

      Testing Teacher

      #Go to the second created test course

      1. Enrol the other user with the role as Teacher
      2. Login as this users and visit the course again
      3. Under the Cog Wheel click More...
      4. Visit Users > Groups and click Auto-create groups button.
      5. Fill the form with any name Group @ and any member count and submit.
      6. Make sure you don't see the error above.
      7. Click the Auto-create-groups button again
      8. Fill the form with any name Group @ and any member count BUT set the Group messaging dropdown to Yes and submit.
      9. Log in as admin
      10. Go to the course where you just created the groups
      11. Under the Cog Wheel click More...
      12. Visit Users > Groups
      13. Confirm that both groups have the correct settings for Group messaging

      Testing no messaging as admin

      1. Go to Site Administration > Messaging > Messaging settings and disable messaging setting.
      2. Go to the third created test course
      3. Under the Cog Wheel click More...
      4. Visit Users > Groups and click Auto-create groups button.
      5. Fill the form with any name Group @ and any member count and submit.
      6. Make sure you don't see the error above.
      Show
      Setup Log in as admin and go make 3 S test courses Go to Site Administration > Users > Permissions > Define roles and click Add new role On the Adding new role form Use role of archetype Teacher and click Continue Edit short name to editingteacher-nocap and custom full name Teacher NoCap Press Crtl+F and search for moodle/course:creategroupconversations and do not Allow this capability then click Create this role. Create two new users whom we can test with Testing Teacher NoCap Go the first created test course Enrol one of the created users with the role as Teacher NoCap Login as this users and visit the course again Under the Cog Wheel click More... Visit Users > Groups and click Auto-create groups button. Fill the form with any name Group @ and any member count and submit. Make sure you don't see the error above. Log in as admin Go to the course where you just created the groups Under the Cog Wheel click More... Visit Users > Groups and select one of the created groups and Edit group settings Confirm that Group messaging is set to no Testing Teacher #Go to the second created test course Enrol the other user with the role as Teacher Login as this users and visit the course again Under the Cog Wheel click More... Visit Users > Groups and click Auto-create groups button. Fill the form with any name Group @ and any member count and submit. Make sure you don't see the error above. Click the Auto-create-groups button again Fill the form with any name Group @ and any member count BUT set the Group messaging dropdown to Yes and submit. Log in as admin Go to the course where you just created the groups Under the Cog Wheel click More... Visit Users > Groups Confirm that both groups have the correct settings for Group messaging Testing no messaging as admin Go to Site Administration > Messaging > Messaging settings and disable messaging setting. Go to the third created test course Under the Cog Wheel click More... Visit Users > Groups and click Auto-create groups button. Fill the form with any name Group @ and any member count and submit. Make sure you don't see the error above.

    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

        1. auto_group_form_messaging_disabled.png
          55 kB
          Scott Verbeek
        2. auto_group_form_messaging_enabled.png
          58 kB
          Scott Verbeek
        3. MDL-66673.jpg
          35 kB
          Anna Carissa Sadia
        4. MDL-66673 (2).jpg
          19 kB
          Anna Carissa Sadia
        5. MDL-66673 notice.png
          143 kB
          Simey Lameze

        Issue Links

          Activity

            People

              scottverbeek Scott Verbeek
              felicecandilio Felice Candilio
              Simey Lameze Simey Lameze
              Adrian Greeve Adrian Greeve
              Anna Carissa Sadia Anna Carissa Sadia
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/May/21

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 5 minutes
                  3h 5m