Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groupid in forums is not cleared #13

Closed
ned-code opened this issue Jan 31, 2019 · 12 comments
Closed

Groupid in forums is not cleared #13

ned-code opened this issue Jan 31, 2019 · 12 comments
Labels
bug Something isn't working

Comments

@ned-code
Copy link

Our site is experiencing a problem with forum groups and I suspect it's related to the autogroup plugin.

In some courses (not all), groups are not applied to forums even though the course has forced-groups enabled. I tried to fix the problem by removing all groups from the course and allowing autogroup to rebuild them, but it looks like this process does not reset the forum groupid in the database, as shown here: https://www.screencast.com/t/KImDQKdh

This info might help diagnose to issue:

  1. The autogroup plugin is using the Institution field to generate groups. Last week, we changed the name of the institution for about 40 user profiles. I suspect this may have something to do with the problem, but I could be wrong.

  2. We changed "Institution" to "Campus" in the Moodle language string, but I doubt this has any impact on the way autogroup manages groups.

  3. All the event triggers are enabled, as shown here: https://www.screencast.com/t/IBtucat7HsD9

Thanks!

@emmarichardson
Copy link
Owner

If you disable the plugin in the course, does it work as expected? What version of Moodle/plugin? I don't really think this plugin would affect that...

@ned-code
Copy link
Author

  • Moodle 3.5.4+ (Build: 20190124)
  • Autogroup 2.4 (Build: 2018070300)
  • Also installed this patch about a month ago.

Disabling the plugin does not help. Neither does deleting and recreating the groups. The groupid for the forums is not cleared in the database. It could be unrelated to the autogroup plugin, in which case I apologize for the false alarm. Just thought it was worth mentioning here, since the problem seemed to arise after the user profile field was changed.

@ned-code
Copy link
Author

This may also be helpful:

Just tried to update and came across this error:

Notice: Undefined variable: dbman in /var/www/moodle/local/autogroup/db/upgrade.php on line 34
Exception - Call to a member function table_exists() on null

https://www.screencast.com/t/iPzm0X6PL

@ned-code
Copy link
Author

I continue to experience this issue on our Moodle site. My latest thinking is that this problem happens because Autogroup messes up the GROUPS IDs in forums (and possibly other activities) when the user
role name is changed at the site level
. I need to do more testing to eliminate other factors, but would appreciate it if others could give it a try as well. It would make me feel slightly less crazy if this problem could be verified by someone else :)

These steps should reproduce the problem. Please don't try this on a production server.

Create (or go) to a test course that has the following features:

  1. Forced groups is turned on in course settings
  2. Autogroup is active and sorts enrolled students into multiple groups
  3. A forum is present with posts/replies from users in different groups

Now to reproduce the problem:

  1. Go to Site Admin > Users > Permissions > Define roles and rename the student role (example: student_1)
  2. Return to the course and check the forum. Note that (some?) students are no longer in their groups. Moreover, if you take a look at the mdl_fourm_discussion table in the database, you should notice that the GROUP IDs for that forum are now either incorrect or missing.
  3. Extra step: Delete all groups in the course and have Autogroups recreate them. Then check the forum again. Note that this doesn't fix the problem.

It's also possible that this could be a Moodle bug (not Autogroup) or possibly a conflict with another plugin. More testing is needed.

Thanks.

@ned-code ned-code reopened this May 17, 2019
@ned-code ned-code reopened this Jun 14, 2019
@emmarichardson
Copy link
Owner

Sorry, I am checking to see if I can find someone to help work on this plugin - if by chance, you have found a fix, please put in a pull request.

@ned-code
Copy link
Author

Ok. I will see if I can find a developer to take a look.

@ned-code
Copy link
Author

It looks like same problem (with forums) occurs if the profile field (which is used by autogroups) is changed after the student has posted to forums.

For example, if the city profile field is used to create groups and the city of a user is changed after she posts to a forum, the group will not not get updated in the forum. It will just disappear.

@ned-code
Copy link
Author

ned-code commented Aug 5, 2019

This scenarios described above will replicated the problem, but the actual cause is as follows:

Moodle handles course groups and forum groups separately. If a group doesn’t have any members, Autogroup will delete the course group but it does not delete/update the groups associated with forum posts. As a result, forum posts associated with the old groups will point to groups that no longer exist.

A fix for this problem can be found here: ned-code#1 (thanks Sergei Porfenovich). This code has not been tested. Looking for testers to verify.

@emmarichardson
Copy link
Owner

emmarichardson commented Aug 5, 2019 via email

@ak4t0sh
Copy link
Collaborator

ak4t0sh commented Aug 5, 2019

Not tested yet but PR seems ok.
I just asked sergei to open PR on this repo. Once done I’ll do a proper code review.

@emmarichardson
Copy link
Owner

emmarichardson commented Aug 5, 2019 via email

@ak4t0sh ak4t0sh added the bug Something isn't working label Aug 5, 2019
@ned-code
Copy link
Author

ned-code commented Aug 9, 2019

The PR can be found here #17

ak4t0sh added a commit to ak4t0sh/local_autogroup that referenced this issue Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants