Bulk Remove Students Tool (Updated 2/16/22)
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Printer Friendly Page
- Report Inappropriate Content
I created a new userscript for removing students from courses in bulk. This will be particularly useful when managing clubs/activity and remediation manually created courses that aren’t set to conclude. For instance, I can see us using this heavily to manage NHS/NJHS, Class of "2018" courses, LOTE clubs, and anything else that has rolling members.
To setup the script –
- Install Tampermonkey (if you don’t have it already)
- Install the script by going to the following link
- Click the “install” button that pops up in Tampermonkey
- Change the "@include" on line 7 to match your institutions Canvas URL setup
// @include https://*.instructure.com/courses/*/users
- It is currently setup to only be visible to admin as our teachers don't have enrollment privileges
- If you are a teacher with enrollment privileges (you can add/remove people), then change Line 22 to include "teacher" as a role.
var buttonRoles = ["teacher", "admin", "root_admin"];
- If you are a teacher with enrollment privileges (you can add/remove people), then change Line 22 to include "teacher" as a role.
To use the script –
- Open Chrome
- Navigate to the people tab in a course and it should pop up near the top.
- Lists student name, section, enrollment date, and last activity date in a sortable table.
- Select All checkbox or select individual students
- This currently only works for students. I figure we don’t usually have more than a handful of teachers in a course, so that can usually be managed by hand.
Let me know what you think and if have feature ideas or improvements, let me know!
*EDIT 2/16/22 - Added pagination to load all students at once and async chunking of removal requests to prevent rate limitation errors. I also added loading icons to make user aware script is running.
*EDIT 4/22/19 - Added Section column*
This is wonderful! Thanks so much! Lisa
This is a very nice tool. I hope to modify it to add and remove teachers.
If the script is modified to add/remove teachers, can you share it with all of us? That would be a great extra feature.
Just make sure to make a fork off of my GitHub
When developing some tools for migrating grades for students from another system to Canvas, I found it useful to be able to remove all of the users from a course (except for myself) and to be able to remove assignments and custom columns from the gradebook. Therefore, I wrote two python script to do this. See Remove users and remove assignments & custom columns: Chip sandbox
Unlike @ @chadscott 's tool, my script does not let you manually selected users, but rather gets rid of all users (except for the user running the program). So the purpose is quite different, but sometimes it is useful to remove all of the users in a course - in order to start over.
I should also note that I used this when experimenting in the test environment so that there are no permanent records generated.
I like Chad's idea. I have one question and one recommendation/suggestion to add.
First the recommendation/suggestion. Could this be adapted for Admins to make quick selections across courses?
The question. The removal feature for Teachers in the People section that was once available for manually added users appears to have disappeared. Is anyone aware of any changes that may have led to this?
I've modified the script so it only works with Observers, interested in making it work with a number of roles. I'm no API developer but I know a bit about programming. I'm finding it only deletes about 10 to 20 observers at a time, wondered if you had any idea why that would be?
Never used GitHub but happy to share with you or follow instructions on how to add it
I was able to change the Bulk Remove Students Tool to Bulk Remove Teachers Tool. IT works on the same principles that if you have more than one Teacher in a shell, you can bulk remove them. Here is a link to the file on our Google Drive. Bulk Teacher Remove Tool. If you are having trouble downloading it, please let me know.
John Bokenoogen, PhD
Director of Academic Technology
University of Oklahoma
I recently noticed that myself. I guess I never tried removing more than a handful at a time during testing. I think it might be hitting up against the API call throttle...I'll have to investigate this summer and come up with a fix. I think others have talked about this issue and I'll just need to find their blog post about it and implement the work-around.
Brilliant Tool - will save so much time
Why would I not get the checkboxes to the left of the students name? Everything else looks good and matches above.
Thanks it worked well
I got as far as seeing the "Manage Course Enrollments" button on the people page.
The button is there, but when I click it, nothing happens. It's just like a dead button.
I've tried both Chrome and Firefox.
Any idea what may be happening?
When I click the button in Chrome or Firefox, it either does nothing, or sometimes the list of students gets added to the bottom of the current page, without the pop-up or the controls to allow checking boxes or removing. I'm not sure what to do about that. A new version of the script or any ideas are welcome. Thanks.
Will this delete students permanently? Or conclude them so I could access them again if needed?
@chadscott , I have the same issues with other users who commented last. I see the Manage Course Enrollments but when I clicked it, nothing happens. Do you have a newer version of the scripts? Appreciate the help.
Oops never mind, I didn't realize the institution URL I need to copy-paste is on the PEOPLE PAGE itself. It works GREAT! Thank you!
It's so frustrating, I just cannot get this to work in either Chrome or Firefox, even if I disable all other extensions and made sure pop-ups are enabled. The "Manage Course Enrollments" button appears on the People tab, but when I click it, nothing happens (no pop-up).
Does anyone have any idea how to get this script working? It seems to have a lot of potential.
Thank you for your help,.
Would one of you be willing to post if this tool is working for you? I've been trying to get it to work for months in multiple browsers and clicking the button still does nothing.
It's not working for me, either.
Sorry it's not working but glad to see it's not just me. I had decided I must be crazy.
Is there anyone on this thread who can help us get this working?
It is working perfectly for me in Chrome with TamperMonkey. Did you follow the instructions to edit the script with your site in the "@include"? Have you inspected to see if any errors are showing up in the console?
I have created another version to delete "completed" /(concluded) enrollments. We need to purge our language placement exams, and the completed students were gluttering the gradebook.
I've made a video showing the exact issue I'm having with the script.
Link to video: https://www.screencast.com/t/YAwv0dUfo
If you have a chance please take a look. Maybe the solution is something obvious that I have missed. I have already allowed pop-ups from the site, so I don't think that's it.
Chrome version: 91.0.4472.114 (Official Build) (64-bit)
THANK YOU so much for this - it's saved me so much time. 🙂
I am experiencing the same thing you've shown in your screencast.
@chadscott ... any way to get this fixed/corrected?
@Chris_Hofer and @c_carrillo1 I'm sorry for the delay in response - It's been rough and I've had to put this tool on the back burner because it needs some work. I plan on redoing this to paginate correctly and fix the exceeding limit issue. Virtual learning has just tabled most of my projects.
I'm not able to reproduce the issue - Can you open the developer panel (F12) and capture the errors that are coming up?
These are the messages I see in the console when I click the Manage Course Enrollments button:
TypeError: $(...).dialog is not a function
at HTMLButtonElement.openDialog (userscript.html?name=Canvas%20Student%20Course%20Enrollment%20Manager.user.js&id=f663adf0-5e57-4d92-a93f-76388f67a374:263)
condition-matcher.ts:136 Problems with selector: "."
Here's a screenshot video: https://www.screencast.com/t/IDKFsB0iqBn
Please let me know what else I can capture. Thanks.
@c_carrillo1 Could you show a screenshot of your code so that we know what the code looks like at line 263, which is the source of the error?
If it is the part where is is $(this).dialog('destroy').remove(), you could try replacing the keyword this with the id and use $('#events_dialog').dialog('destroy').remove() instead
Here is a screenshot of the Tampermonkey script showing line 263 and context:
I tried changing line 267 to "$('#events_dialog').dialog('destroy').remove()". It did not seem to make any difference in terms of behavior.
Thank you for your help.
I notice the same behavior with the tool. Looking thru the usercript, I've added this line of code after 422 row.
Then I reloaded the page and it worked!, I guess there is a conflict with Canvas Jquery libraries and this userscript. @chadscott
One side note, even with this fix when I click the remove student button it doesn't remove any of them....
@xcotto1 thanks, but could you be a little more specific about where you added that line? I tried adding it after line 422 (right in the middle of a for-loop), but it didn't change anything for me.
Here's where I added it: https://www.screencast.com/t/puUhKtxnz
It sounds like maybe your fix didn't work anyway, though, as you noted the students were not removed when you actually tried to use the tool...
Sure, Make sure is added above this line
here is where I've added the code.
Looks like you have more code lines than I do. Are you using the latest version? Source code: https://github.com/sukotsuchido/CanvasUserScripts/blob/master/Canvas%20Remove%20Student%20Tool.user....
Let me know if it works for you.
@xcotto1 Oh I see! You meant add as line 442 not line 422 🙂
I added your line and it's working for me now!!! It is even removing students correctly!
Thank you so much for this fix!
@xcotto1 Good job 🙂 I'll keep this in my pocket. I'll update here when I can get some time to do a rework - I've learned quite a bit since starting writing scripts and need to go back and redo the majority of the ones I've made to make them more efficient and add some features.
Thanks to you @chadscott for creating these wonderful scripts!, trust me it is a huge time saver 😎
Any way I can replace the variable for student name and replace with student email? We have graduation years in our email structure and want to use that to delete all of the graduating seniors and be able to add all the freshman students to a given class, as an example.
Also, if you have problems running it, try in a different window if you have two screens, mine worked poorly until I moved the window in Chrome over to my non-main display. Not sure why, but if it works for someone else, there's that.
Does anyone know why in a sudden the script can't take more than 100 students at a time any more. I would had to remove some before I can do the batch remove again. Beside that, sometime I had to refresh the page in order to run the script.
@qnguyen and others, I wanted to bump the post - I've updated the script on github to solve a few lingering issues that I've finally had some time to figure out.
The script will now load all students at once. I've also added async chunking to the delete requests to avoid rate limit errors.
Since some of this requires some waiting, I've added a nice loading icon so the user knows the script is working.
I've added the noConflict(true) back to the bottom of the script and bumped the version to 2.11 on github.
This fixed everything for me. It's working!
wauw, just wauw, 🙂 a life saver 🙂
Is it possible to bulk remove students from one specific section only?
Yes, @u0480404 . The dialog is sortable by section, so that makes it easier to select students from one section only.
Thanks for another great script. Although I can't use it(I am an instructor, and doubt that my teacher role will give me permissions), I still look at the scripts.
ONe thing I don't like are all the warning signs that show up in the scripts(just me, I know the work). But since you wrote about always learning about improving your scripts, I found the following on stack overflow relating to most of the warnings involving the $ use. So I thought I would pass it along.
At the header part of the script, add one line as shown below to remove the warnings on the $
/* eslint-env jquery */ <==== add this line
here is the stack overflow post:
Also, I forgot to mention that (as you may already know) include is being deprecated and that match should be used instead. I did check my ability to use the script and I could bulk delete students if I wanted, but for my role, I have no need to do that.
Thanks again for a great script. I just looked into it again today, and I wanted to change the color of the button, and it was not working from what I had seen in other scripts. I finally found out why.
on line 40, you have
which gives me a gray button (which may have been your intention), but If I change button-primary to Button--primary I get the blue color box selection. I wanted the button to be green, so I used Button--success.
So to get the primary blue color, button has to be capitalized and the double hyphen is needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.