Moodle

Remove orphaned users from groups

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8.3, 1.9
  • Fix Version/s: None
  • Component/s: Groups
  • Labels:
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

I've seen sites with a lot of group members who are deleted. They are still displayed in the interface and caused a lot of confusion.

mysql> select count from mdl_user u, mdl_groups_members m WHERE u.id = m.userid AND u.deleted = 1;

We need to clean this up in upgrade & also ensure the group members are deleted when removing courses & users etc.

Activity

Hide
Dan Poltawski added a comment -

I guess something like delete m from mdl_user u, mdl_groups_members m WHERE u.id = m.userid AND u.deleted = 1;

Show
Dan Poltawski added a comment - I guess something like delete m from mdl_user u, mdl_groups_members m WHERE u.id = m.userid AND u.deleted = 1;
Hide
Petr Škoda (skodak) added a comment -

Hmm, user deleting might have other problems too - does it clear user subscriptions and role assignments? I will have to check this out...
thanks for the report...

Show
Petr Škoda (skodak) added a comment - Hmm, user deleting might have other problems too - does it clear user subscriptions and role assignments? I will have to check this out... thanks for the report...
Hide
Dan Poltawski added a comment -

Role assignments look ok, but don't know about how many of these we care about:

mysql> select count from mdl_user u, mdl_forum_subscriptions s WHERE u.id = s.userid AND u.deleted = 1;
----------

count

----------

13

----------
1 row in set (0.07 sec)

mysql> select count from mdl_user u, mdl_user_preferences p WHERE u.id = p.userid AND u.deleted = 1;
----------

count

----------

1232

----------
1 row in set (0.12 sec)

mysql> select count from mdl_user u, mdl_user_lastaccess a WHERE u.id = a.userid AND u.deleted = 1;
----------

count

----------

4546

----------
1 row in set (0.03 sec)

Also user_info_data? blogs?

Show
Dan Poltawski added a comment - Role assignments look ok, but don't know about how many of these we care about: mysql> select count from mdl_user u, mdl_forum_subscriptions s WHERE u.id = s.userid AND u.deleted = 1; ----------
count
----------
13
---------- 1 row in set (0.07 sec) mysql> select count from mdl_user u, mdl_user_preferences p WHERE u.id = p.userid AND u.deleted = 1; ----------
count
----------
1232
---------- 1 row in set (0.12 sec) mysql> select count from mdl_user u, mdl_user_lastaccess a WHERE u.id = a.userid AND u.deleted = 1; ----------
count
----------
4546
---------- 1 row in set (0.03 sec) Also user_info_data? blogs?
Hide
Petr Škoda (skodak) added a comment -

ohlala, that is a lot of obsoleted data - sounds like a job for 2.0 - special cleanup option for deleted users, the trouble is we can not delete everything, for example forum posts should stay even if we delete users because posts of other ppl might depend on that

Show
Petr Škoda (skodak) added a comment - ohlala, that is a lot of obsoleted data - sounds like a job for 2.0 - special cleanup option for deleted users, the trouble is we can not delete everything, for example forum posts should stay even if we delete users because posts of other ppl might depend on that
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: