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

Auto-create Groups Notice

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7, 3.11
    • Fix Version/s: 3.9.7, 3.10.4
    • Component/s: Groups
    • Labels:
    • Affected Branches:
      MOODLE_311_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
      MDL-66673-MOODLE_39_STABLE
    • Pull 3.10 Branch:
      MDL-66673-MOODLE_310_STABLE
    • Pull 3.11 Branch:
      MDL-66673-MOODLE_311_STABLE
    • Pull Master Branch:
      MDL-66673-master
    • Testing Instructions:
      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

          Issue Links

            Activity

              People

              Assignee:
              scottverbeek Scott Verbeek
              Reporter:
              felicecandilio Felice Candilio
              Peer reviewer:
              Simey Lameze Simey Lameze
              Integrator:
              Adrian Greeve Adrian Greeve
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                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