Deleting users via CSV

Deleting users via CSV

by Albert Ramsbottom -
Number of replies: 4

I have been looking at the deleting users csv wiki page and have the following example

username,firstname,lastname,deleted

reznort,,,1

Now can i delete users, using the ID (primary key), and not use the username as some of our usernames are the same


Cheers


Average of ratings: -
In reply to Albert Ramsbottom

Re: Deleting users via CSV

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

"some of our usernames are the same"

That sounds very unlikely. The *only* way that can happen is that you have the same username but a different mnet ids. Are you using mnet with *incoming* users from other sites?

In reply to Albert Ramsbottom

Re: Deleting users via CSV

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

"some of our usernames are the same"

That sounds very unlikely. The *only* way that can happen is that you have the same username but a different mnet ids. Are you using mnet with *incoming* users from other sites?

In reply to Howard Miller

Re: Deleting users via CSV

by Albert Ramsbottom -

We are using a custom Course/User import system based on sits

Some teachers have restored courses from an old Moodle where the student ids are different, so Moodle has created two users both with the same username and email but with a different idnumber and auth method

Not sure if that makes sense

So we have a csv from the DB that includes id, username, and idnumber

These duplicate becuase the username and email are the same but they do have the id field as the primary key so was wondering if I could use this in the upoad user csv


Cheers

In reply to Albert Ramsbottom

Re: Deleting users via CSV

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The username and mnetid id in the mdl_user table form a unique index. So... assuming your mnetid is only ever 1 (likely) then you can't have different usernames. Unless, of course, your database has been hacked around with to remove the unique index.

In which case.... you deserve your current predicament big grin